hg status issue on Windows with network servers

Alexis S. L. Carvalho alexis at cecm.usp.br
Mon Mar 10 17:37:09 CDT 2008

Thus spake TK Soh:
> We recently added a netapp file server that serve both Unix (NFS) and
> Windows (CIFS) users. Naturally, I use Mercurial on both platforms.
> I mapped the server on XP (SP2) to drive X:, open a cmd window in a
> repo that has been reported clean by 'hg st' on Unix (the repo has
> been created and maintained on Unix), and entered 'hg st' command,
> then a list of files showed up as being modified, while 'hg diff
> --git' give an empty output. It turns out that these files have had
> their executable permission bits enabled.

The following patch should make this better, but you'll probably have
some problems if you use "hg update -C" on windows and then try to use
status/diff/commit on unix - hg won't show any file differences (which
is fine), but if you change some executable file and then commit it,
it'll probably silently lose the exec bit.


diff -r 58334bb7b93e mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -63,6 +63,9 @@ class dirstate(object):
         elif name == '_slash':
             self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/'
             return self._slash
+        elif name == '_checkexec':
+            self._checkexec = util.checkexec(self._root)
+            return self._checkexec
             raise AttributeError, name
@@ -578,8 +581,9 @@ class dirstate(object):
             if type_ == 'n':
                 if not st:
                     st = lstat(_join(fn))
-                if (size >= 0 and (size != st.st_size
-                                   or (mode ^ st.st_mode) & 0100)
+                if (size >= 0 and
+                    (size != st.st_size
+                     or ((mode ^ st.st_mode) & 0100 and self._checkexec))
                     or size == -2
                     or fn in self._copymap):

More information about the Mercurial-devel mailing list