Patchwork D401: filemerge: add `_workingpath`

login
register
mail settings
Submitter phabricator
Date Aug. 25, 2017, 10:10 p.m.
Message ID <fe437ab5b63bb73a22371480717c0ace@localhost.localdomain>
Download mbox | patch
Permalink /patch/23358/
State Not Applicable
Headers show

Comments

phabricator - Aug. 25, 2017, 10:10 p.m.
phillco updated this revision to Diff 1310.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D401?vs=1306&id=1310

REVISION DETAIL
  https://phab.mercurial-scm.org/D401

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS




To: phillco, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -478,8 +478,8 @@ 
     This implies permerge. Therefore, files aren't dumped, if premerge
     runs successfully. Use :forcedump to forcibly write files out.
     """
-    a, b, c, back = files
-
+    unused, unused, unused, unused = files
+    a = _workingpath(repo, fcd)
     fd = fcd.path()
 
     util.copyfile(a, a + ".local")
@@ -503,7 +503,8 @@ 
         repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
                        'for %s\n') % (tool, fcd.path()))
         return False, 1, None
-    a, b, c, back = files
+    unused, b, c, back = files
+    a = _workingpath(repo, fcd)
     out = ""
     env = {'HG_FILE': fcd.path(),
            'HG_MY_NODE': short(mynode),
@@ -605,7 +606,7 @@ 
     if fcd.isabsent():
         return None
 
-    a = repo.wjoin(fcd.path())
+    a = _workingpath(repo, fcd)
     back = scmutil.origpath(ui, repo, a)
     if premerge:
         util.copyfile(a, back)
@@ -714,7 +715,7 @@ 
                                      toolconf, files, labels=labels)
 
         if needcheck:
-            r = _check(r, ui, tool, fcd, files)
+            r = _check(repo, r, ui, tool, fcd, files)
 
         if r:
             if onfailure:
@@ -727,7 +728,7 @@ 
         util.unlink(files[1])
         util.unlink(files[2])
 
-def _check(r, ui, tool, fcd, files):
+def _check(repo, r, ui, tool, fcd, files):
     fd = fcd.path()
     a, unused, unused, back = files
 
@@ -747,17 +748,20 @@ 
     if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
                                   'changed' in
                                   _toollist(ui, tool, "check")):
-        if back is not None and filecmp.cmp(a, back):
+        if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
             if ui.promptchoice(_(" output file %s appears unchanged\n"
                                  "was merge successful (yn)?"
                                  "$$ &Yes $$ &No") % fd, 1):
                 r = 1
 
     if back is not None and _toolbool(ui, tool, "fixeol"):
-        _matcheol(a, back)
+        _matcheol(_workingpath(repo, fcd), back)
 
     return r
 
+def _workingpath(repo, ctx):
+    return repo.wjoin(ctx.path())
+
 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
     return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
                       labels=labels)