diff mercurial/dirstate.py @ 15337:cf5f9df6406b stable

windows: recompute flags when committing a merge (issue1802) Before this patch, Windows always did the wrong thing with exec bits when committing a merge: consult the flags in first parent. Now we manually recompute the result of merging flags at commit time, which almost always does the right thing (except when there are conflicts between symlink and exec flags). To do this, we: - pull flag synthesis out into its own function - delay building this function unless it's needed - add a merge case that compares flags in local and other against the ancestor This has been tested in multiple ways on Linux: - running the whole test suite with both old and new code in place, checking for differences in each flags() result - running the whole test suite while comparing real on-disk flags against synthetic ones for merges - test-issue1802 (from Martin Geisler) which disables exec bit checking on Unix
author Matt Mackall <mpm@selenic.com>
date Sat, 22 Oct 2011 16:12:33 -0500
parents 774da7121fc9
children 41453d55b481
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Oct 21 15:09:33 2011 -0500
+++ b/mercurial/dirstate.py	Sat Oct 22 16:12:33 2011 -0500
@@ -131,17 +131,19 @@
         # it's safe because f is always a relative path
         return self._rootdir + f
 
-    def flagfunc(self, fallback):
+    def flagfunc(self, buildfallback):
+        if self._checklink and self._checkexec:
+            def f(x):
+                p = self._join(x)
+                if os.path.islink(p):
+                    return 'l'
+                if util.isexec(p):
+                    return 'x'
+                return ''
+            return f
+
+        fallback = buildfallback()
         if self._checklink:
-            if self._checkexec:
-                def f(x):
-                    p = self._join(x)
-                    if os.path.islink(p):
-                        return 'l'
-                    if util.isexec(p):
-                        return 'x'
-                    return ''
-                return f
             def f(x):
                 if os.path.islink(self._join(x)):
                     return 'l'
@@ -157,7 +159,8 @@
                     return 'x'
                 return ''
             return f
-        return fallback
+        else:
+            return fallback
 
     def getcwd(self):
         cwd = os.getcwd()