hgext/largefiles/overrides.py
changeset 20295 36333ff8c54d
parent 20156 28fe5abc906f
child 20296 675f578856dd
equal deleted inserted replaced
20294:243ea5ffdf31 20295:36333ff8c54d
   413             processed.append(action)
   413             processed.append(action)
   414 
   414 
   415     return processed
   415     return processed
   416 
   416 
   417 # Override filemerge to prompt the user about how they wish to merge
   417 # Override filemerge to prompt the user about how they wish to merge
   418 # largefiles. This will handle identical edits, and copy/rename +
   418 # largefiles. This will handle identical edits without prompting the user.
   419 # edit without prompting the user.
       
   420 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
   419 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
   421     # Use better variable names here. Because this is a wrapper we cannot
   420     # Use better variable names here. Because this is a wrapper we cannot
   422     # change the variable names in the function declaration.
   421     # change the variable names in the function declaration.
   423     fcdest, fcother, fcancestor = fcd, fco, fca
   422     fcdest, fcother, fcancestor = fcd, fco, fca
   424     if not lfutil.isstandin(orig):
   423     if not lfutil.isstandin(orig):
   425         return origfn(repo, mynode, orig, fcdest, fcother, fcancestor)
   424         return origfn(repo, mynode, orig, fcdest, fcother, fcancestor)
   426     else:
   425     else:
   427         if not fcother.cmp(fcdest): # files identical?
   426         if not fcother.cmp(fcdest): # files identical?
   428             return None
   427             return None
   429 
   428 
   430         # backwards, use working dir parent as ancestor
       
   431         if fcancestor == fcother:
       
   432             fcancestor = fcdest.parents()[0]
       
   433 
       
   434         if orig != fcother.path():
   429         if orig != fcother.path():
   435             repo.ui.status(_('merging %s and %s to %s\n')
   430             repo.ui.status(_('merging %s and %s to %s\n')
   436                            % (lfutil.splitstandin(orig),
   431                            % (lfutil.splitstandin(orig),
   437                               lfutil.splitstandin(fcother.path()),
   432                               lfutil.splitstandin(fcother.path()),
   438                               lfutil.splitstandin(fcdest.path())))
   433                               lfutil.splitstandin(fcdest.path())))
   439         else:
   434         else:
   440             repo.ui.status(_('merging %s\n')
   435             repo.ui.status(_('merging %s\n')
   441                            % lfutil.splitstandin(fcdest.path()))
   436                            % lfutil.splitstandin(fcdest.path()))
   442 
       
   443         if fcancestor.path() != fcother.path() and fcother.data() == \
       
   444                 fcancestor.data():
       
   445             return 0
       
   446         if fcancestor.path() != fcdest.path() and fcdest.data() == \
       
   447                 fcancestor.data():
       
   448             repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
       
   449             return 0
       
   450 
   437 
   451         if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
   438         if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
   452                                   'keep (l)ocal or take (o)ther?'
   439                                   'keep (l)ocal or take (o)ther?'
   453                                   '$$ &Local $$ &Other') %
   440                                   '$$ &Local $$ &Other') %
   454                                 lfutil.splitstandin(orig), 0) == 0:
   441                                 lfutil.splitstandin(orig), 0) == 0: