RFC: Extdiff change, use absolute paths for temp files

Jason Harris jason at jasonfharris.com
Mon Mar 21 11:32:48 CDT 2011


Is there any reason the following change shouldn't be made. It fixes the use of p4merge, and the other merge tool I tried (filemerge on OSX) still works fine with this change. However, I must confess I don't understand why an absolute path wasn't used in the first place when it is used for dir2 in any case...

Thanks,
  Jas

# HG changeset patch
# User jfh <jason at jasonfharris.com>
# Date 2011-03-21 17:04:16 +0100
# Node ID 67ab687aa2d4adf2db30ecb75681b8e6f3b6157c
# Parent  48d606d7192b6f8f4fc8071fccdc5a83843ab2d3
use the absolute path for any temporary files.

This allows the use of p4merge amongst possible other external tools.

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -187,14 +187,14 @@
         # Handle bogus modifies correctly by checking if the files exist
         if len(common) == 1:
             common_file = util.localpath(common.pop())
-            dir1a = os.path.join(dir1a, common_file)
+            dir1a = os.path.join(tmproot, dir1a, common_file)
             label1a = common_file + rev1a
-            if not os.path.isfile(os.path.join(tmproot, dir1a)):
+            if not os.path.isfile(dir1a):
                 dir1a = os.devnull
             if do3way:
-                dir1b = os.path.join(dir1b, common_file)
+                dir1b = os.path.join(tmproot, dir1b, common_file)
                 label1b = common_file + rev1b
-                if not os.path.isfile(os.path.join(tmproot, dir1b)):
+                if not os.path.isfile(dir1b):
                     dir1b = os.devnull
             dir2 = os.path.join(dir2root, dir2, common_file)
             label2 = common_file + rev2



More information about the Mercurial-devel mailing list