[Updated] D12190: filemerge: move removal of `.orig` extension on temp file close to context

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


Closed by commit rHGb53f2f5a18de: filemerge: move removal of `.orig` extension on temp file close to context (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/D12190?vs=32228&id=32247

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

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

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
@@ -746,6 +746,9 @@
     localoutputpath = None
     if b"$output" in args:
         localoutputpath = backup.path()
+        # Remove the .orig to make syntax-highlighting more likely.
+        if localoutputpath.endswith(b'.orig'):
+            localoutputpath, ext = os.path.splitext(localoutputpath)
 
     with _maketempfiles(
         fco,
@@ -940,10 +943,6 @@
     c = tempfromcontext(b"other", fco)
     d = localpath
     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'):
-            d, _ = os.path.splitext(d)
         f, d = maketempfrompath(b"local", d)
         with open(localpath, b'rb') as src:
             f.write(src.read())



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/44f08e38/attachment-0002.html>


More information about the Mercurial-patches mailing list