Patchwork [2,of,3,V3] dirstate.status: don't ignore symlink placeholders in the normal set

mail settings
Submitter Siddharth Agarwal
Date Sept. 3, 2013, 7:37 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/2304/
State Accepted
Commit 902c646019ad9c9e2bc07e0b4f3f3c41b7087fb7
Headers show


Siddharth Agarwal - Sept. 3, 2013, 7:37 p.m.
# HG changeset patch
# User Siddharth Agarwal <>
# Date 1377969615 25200
#      Sat Aug 31 10:20:15 2013 -0700
# Node ID 54504a7b14167cce4df78a6f20d4f1b02ccd8328
# Parent  37f868a08266f180b8474eef2667aaf76629aae1
dirstate.status: don't ignore symlink placeholders in the normal set

On Windows, there are two ways symlinks can manifest themselves:
1. As placeholders: text files containing the symlink's target. This is what
   usually happens with fresh clones on Windows.
2. With their dereferenced contents. This happens with clones accessed over NFS
   or Samba.

In order to handle case 2, ca6cebd8734e made dirstate.status ignore all symlink
placeholders on Windows. It doesn't ignore symlinks in the lookup set, though,
since those don't have the link bit set. This is problematic because it
violates the invariant that `hg status` with every file in the normal set
produces the same output as `hg status` with every file in the lookup set.

With this change, symlink placeholders in the normal set are no longer ignored.
We instead rely on code in localrepo.status that uses heuristics to look for
suspect placeholders.

An upcoming patch will test this out by no longer adding files written in the
last second of an update to the lookup set.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -801,12 +801,9 @@ 
         mexact = match.exact
         dirignore = self._dirignore
         checkexec = self._checkexec
-        checklink = self._checklink
         copymap = self._copymap
         lastnormaltime = self._lastnormaltime
-        lnkkind = stat.S_IFLNK
         # We need to do full walks when either
         # - we're listing all clean files, or
         # - match.traversedir does something, because match.traversedir should
@@ -827,20 +824,14 @@ 
             if not st and state in "nma":
             elif state == 'n':
-                # The "mode & lnkkind != lnkkind or self._checklink"
-                # lines are an expansion of "islink => checklink"
-                # where islink means "is this a link?" and checklink
-                # means "can we check links?".
                 mtime = int(st.st_mtime)
                 if (size >= 0 and
                     ((size != st.st_size and size != st.st_size & _rangemask)
                      or ((mode ^ st.st_mode) & 0100 and checkexec))
-                    and (mode & lnkkind != lnkkind or checklink)
                     or size == -2 # other parent
                     or fn in copymap):
-                elif ((time != mtime and time != mtime & _rangemask)
-                      and (mode & lnkkind != lnkkind or checklink)):
+                elif time != mtime and time != mtime & _rangemask:
                 elif mtime == lastnormaltime:
                     # fn may have been changed in the same timeslot without