mercurial/filemerge.py
changeset 26948 067ab07435c9
parent 26941 454deda24315
child 26967 7a8e9a985c3b
equal deleted inserted replaced
26947:fdfc50d09e8d 26948:067ab07435c9
   242             return 0
   242             return 0
   243         if premerge not in validkeep:
   243         if premerge not in validkeep:
   244             util.copyfile(back, a) # restore from backup and try again
   244             util.copyfile(back, a) # restore from backup and try again
   245     return 1 # continue merging
   245     return 1 # continue merging
   246 
   246 
   247 def _symlinkcheck(repo, mynode, orig, fcd, fco, fca, toolconf):
   247 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
   248     tool, toolpath, binary, symlink = toolconf
   248     tool, toolpath, binary, symlink = toolconf
   249     if symlink:
   249     if symlink:
   250         repo.ui.warn(_('warning: internal %s cannot merge symlinks '
   250         repo.ui.warn(_('warning: internal %s cannot merge symlinks '
   251                        'for %s\n') % (tool, fcd.path()))
   251                        'for %s\n') % (tool, fcd.path()))
   252         return False
   252         return False
   266     return True, r
   266     return True, r
   267 
   267 
   268 @internaltool('union', fullmerge,
   268 @internaltool('union', fullmerge,
   269               _("warning: conflicts while merging %s! "
   269               _("warning: conflicts while merging %s! "
   270                 "(edit, then use 'hg resolve --mark')\n"),
   270                 "(edit, then use 'hg resolve --mark')\n"),
   271               precheck=_symlinkcheck)
   271               precheck=_mergecheck)
   272 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   272 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   273     """
   273     """
   274     Uses the internal non-interactive simple merge algorithm for merging
   274     Uses the internal non-interactive simple merge algorithm for merging
   275     files. It will use both left and right sides for conflict regions.
   275     files. It will use both left and right sides for conflict regions.
   276     No markers are inserted."""
   276     No markers are inserted."""
   278                   files, labels, 'union')
   278                   files, labels, 'union')
   279 
   279 
   280 @internaltool('merge', fullmerge,
   280 @internaltool('merge', fullmerge,
   281               _("warning: conflicts while merging %s! "
   281               _("warning: conflicts while merging %s! "
   282                 "(edit, then use 'hg resolve --mark')\n"),
   282                 "(edit, then use 'hg resolve --mark')\n"),
   283               precheck=_symlinkcheck)
   283               precheck=_mergecheck)
   284 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   284 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   285     """
   285     """
   286     Uses the internal non-interactive simple merge algorithm for merging
   286     Uses the internal non-interactive simple merge algorithm for merging
   287     files. It will fail if there are any conflicts and leave markers in
   287     files. It will fail if there are any conflicts and leave markers in
   288     the partially merged file. Markers will have two sections, one for each side
   288     the partially merged file. Markers will have two sections, one for each side
   291                   files, labels, 'merge')
   291                   files, labels, 'merge')
   292 
   292 
   293 @internaltool('merge3', fullmerge,
   293 @internaltool('merge3', fullmerge,
   294               _("warning: conflicts while merging %s! "
   294               _("warning: conflicts while merging %s! "
   295                 "(edit, then use 'hg resolve --mark')\n"),
   295                 "(edit, then use 'hg resolve --mark')\n"),
   296               precheck=_symlinkcheck)
   296               precheck=_mergecheck)
   297 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   297 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
   298     """
   298     """
   299     Uses the internal non-interactive simple merge algorithm for merging
   299     Uses the internal non-interactive simple merge algorithm for merging
   300     files. It will fail if there are any conflicts and leave markers in
   300     files. It will fail if there are any conflicts and leave markers in
   301     the partially merged file. Marker will have three sections, one from each
   301     the partially merged file. Marker will have three sections, one from each
   316     a, b, c, back = files
   316     a, b, c, back = files
   317     r = simplemerge.simplemerge(repo.ui, a, b, c, label=labels,
   317     r = simplemerge.simplemerge(repo.ui, a, b, c, label=labels,
   318                                 localorother=localorother)
   318                                 localorother=localorother)
   319     return True, r
   319     return True, r
   320 
   320 
   321 @internaltool('merge-local', mergeonly, precheck=_symlinkcheck)
   321 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
   322 def _imergelocal(*args, **kwargs):
   322 def _imergelocal(*args, **kwargs):
   323     """
   323     """
   324     Like :merge, but resolve all conflicts non-interactively in favor
   324     Like :merge, but resolve all conflicts non-interactively in favor
   325     of the local changes."""
   325     of the local changes."""
   326     success, status = _imergeauto(localorother='local', *args, **kwargs)
   326     success, status = _imergeauto(localorother='local', *args, **kwargs)
   327     return success, status
   327     return success, status
   328 
   328 
   329 @internaltool('merge-other', mergeonly, precheck=_symlinkcheck)
   329 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
   330 def _imergeother(*args, **kwargs):
   330 def _imergeother(*args, **kwargs):
   331     """
   331     """
   332     Like :merge, but resolve all conflicts non-interactively in favor
   332     Like :merge, but resolve all conflicts non-interactively in favor
   333     of the other changes."""
   333     of the other changes."""
   334     success, status = _imergeauto(localorother='other', *args, **kwargs)
   334     success, status = _imergeauto(localorother='other', *args, **kwargs)