mercurial/filemerge.py
changeset 28578 66d085e55ecd
parent 27651 07fc2f2134ba
child 28640 4fc640fd0026
equal deleted inserted replaced
28577:7efff6ce9826 28578:66d085e55ecd
   228             if newdata != data:
   228             if newdata != data:
   229                 util.writefile(file, newdata)
   229                 util.writefile(file, newdata)
   230 
   230 
   231 @internaltool('prompt', nomerge)
   231 @internaltool('prompt', nomerge)
   232 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf):
   232 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf):
   233     """Asks the user which of the local or the other version to keep as
   233     """Asks the user which of the local (p1) or the other (p2) version to keep
   234     the merged version."""
   234     as the merged version."""
   235     ui = repo.ui
   235     ui = repo.ui
   236     fd = fcd.path()
   236     fd = fcd.path()
   237 
   237 
   238     try:
   238     try:
   239         if fco.isabsent():
   239         if fco.isabsent():
   266         ui.write("\n")
   266         ui.write("\n")
   267         return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
   267         return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
   268 
   268 
   269 @internaltool('local', nomerge)
   269 @internaltool('local', nomerge)
   270 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
   270 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
   271     """Uses the local version of files as the merged version."""
   271     """Uses the local (p1) version of files as the merged version."""
   272     return 0, fcd.isabsent()
   272     return 0, fcd.isabsent()
   273 
   273 
   274 @internaltool('other', nomerge)
   274 @internaltool('other', nomerge)
   275 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
   275 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
   276     """Uses the other version of files as the merged version."""
   276     """Uses the other (p2) version of files as the merged version."""
   277     if fco.isabsent():
   277     if fco.isabsent():
   278         # local changed, remote deleted -- 'deleted' picked
   278         # local changed, remote deleted -- 'deleted' picked
   279         repo.wvfs.unlinkpath(fcd.path())
   279         repo.wvfs.unlinkpath(fcd.path())
   280         deleted = True
   280         deleted = True
   281     else:
   281     else:
   409 
   409 
   410 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
   410 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
   411 def _imergelocal(*args, **kwargs):
   411 def _imergelocal(*args, **kwargs):
   412     """
   412     """
   413     Like :merge, but resolve all conflicts non-interactively in favor
   413     Like :merge, but resolve all conflicts non-interactively in favor
   414     of the local changes."""
   414     of the local (p1) changes."""
   415     success, status = _imergeauto(localorother='local', *args, **kwargs)
   415     success, status = _imergeauto(localorother='local', *args, **kwargs)
   416     return success, status, False
   416     return success, status, False
   417 
   417 
   418 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
   418 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
   419 def _imergeother(*args, **kwargs):
   419 def _imergeother(*args, **kwargs):
   420     """
   420     """
   421     Like :merge, but resolve all conflicts non-interactively in favor
   421     Like :merge, but resolve all conflicts non-interactively in favor
   422     of the other changes."""
   422     of the other (p2) changes."""
   423     success, status = _imergeauto(localorother='other', *args, **kwargs)
   423     success, status = _imergeauto(localorother='other', *args, **kwargs)
   424     return success, status, False
   424     return success, status, False
   425 
   425 
   426 @internaltool('tagmerge', mergeonly,
   426 @internaltool('tagmerge', mergeonly,
   427               _("automatic tag merging of %s failed! "
   427               _("automatic tag merging of %s failed! "