[Updated] D12189: filemerge: remove `uselocalpath` argument from `_maketempfiles()`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Feb 16 10:31:04 UTC 2022


Closed by commit rHG9d0d0a388c39: filemerge: remove `uselocalpath` argument from `_maketempfiles()` (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12189?vs=32227&id=32246

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12189/new/

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -743,9 +743,14 @@
         return False, 1, None
     localpath = _workingpath(repo, fcd)
     args = _toolstr(repo.ui, tool, b"args")
+    localoutputpath = None
+    if b"$output" in args:
+        localoutputpath = backup.path()
 
     with _maketempfiles(
-        fco, fca, backup.path(), b"$output" in args
+        fco,
+        fca,
+        localoutputpath,
     ) as temppaths:
         basepath, otherpath, localoutputpath = temppaths
         outpath = b""
@@ -908,10 +913,10 @@
 
 
 @contextlib.contextmanager
-def _maketempfiles(fco, fca, localpath, uselocalpath):
-    """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
-    copies `localpath` to another temporary file, so an external merge tool may
-    use them.
+def _maketempfiles(fco, fca, localpath):
+    """Writes out `fco` and `fca` as temporary files, and (if localpath is not
+    None) copies `localpath` to another temporary file, so an external merge
+    tool may use them.
     """
     tmproot = pycompat.mkdtemp(prefix=b'hgmerge-')
 
@@ -934,7 +939,7 @@
     b = tempfromcontext(b"base", fca)
     c = tempfromcontext(b"other", fco)
     d = localpath
-    if uselocalpath:
+    if localpath is not None:
         # We start off with this being the backup filename, so remove the .orig
         # to make syntax-highlighting more likely.
         if d.endswith(b'.orig'):



To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220216/b46e712a/attachment-0002.html>


More information about the Mercurial-patches mailing list