Merge with stable
authorMartin Geisler <mg@aragost.com>
Mon, 09 Aug 2010 16:08:33 +0200
changeset 11770 4b8dc59e22b9
parent 11768 dc5ce9c95d00 (current diff)
parent 11769 ca6cebd8734e (diff)
child 11771 b0e3d3973440
Merge with stable
--- a/mercurial/dirstate.py	Sun Aug 08 23:10:08 2010 +0200
+++ b/mercurial/dirstate.py	Mon Aug 09 16:08:33 2010 +0200
@@ -625,6 +625,8 @@
         dadd = deleted.append
         cadd = clean.append
 
+        lnkkind = stat.S_IFLNK
+
         for fn, st in self.walk(match, subrepos, listunknown,
                                 listignored).iteritems():
             if fn not in dmap:
@@ -640,13 +642,19 @@
             if not st and state in "nma":
                 dadd(fn)
             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?".
                 if (size >= 0 and
                     (size != st.st_size
                      or ((mode ^ st.st_mode) & 0100 and self._checkexec))
+                    and (mode & lnkkind != lnkkind or self._checklink)
                     or size == -2 # other parent
                     or fn in self._copymap):
                     madd(fn)
-                elif time != int(st.st_mtime):
+                elif (time != int(st.st_mtime)
+                      and (mode & lnkkind != lnkkind or self._checklink)):
                     ladd(fn)
                 elif listclean:
                     cadd(fn)
--- a/tests/test-symlink-os-yes-fs-no.py	Sun Aug 08 23:10:08 2010 +0200
+++ b/tests/test-symlink-os-yes-fs-no.py	Mon Aug 09 16:08:33 2010 +0200
@@ -1,5 +1,5 @@
-import os, sys
-from mercurial import hg, ui
+import os, sys, time
+from mercurial import hg, ui, commands
 
 TESTDIR = os.environ["TESTDIR"]
 
@@ -7,11 +7,35 @@
 if not hasattr(os, "symlink"):
     sys.exit(80) # SKIPPED_STATUS defined in run-tests.py
 
-# this is what symlink would do on a non-symlink file system
+# clone with symlink support
+u = ui.ui()
+hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test0')
+
+repo = hg.repository(u, 'test0')
+
+# wait a bit, or the status call wont update the dirstate
+time.sleep(1)
+commands.status(u, repo)
+
+# now disable symlink support -- this is what os.symlink would do on a
+# non-symlink file system
 def symlink_failure(src, dst):
     raise OSError, (1, "Operation not permitted")
 os.symlink = symlink_failure
 
-# now try cloning a repo which contains symlinks
+# dereference links as if a Samba server has exported this to a
+# Windows client
+for f in 'test0/a.lnk', 'test0/d/b.lnk':
+    os.unlink(f)
+    fp = open(f, 'wb')
+    fp.write(open(f[:-4]).read())
+    fp.close()
+
+# reload repository
+u = ui.ui()
+repo = hg.repository(u, 'test0')
+commands.status(u, repo)
+
+# try cloning a repo which contains symlinks
 u = ui.ui()
 hg.clone(u, os.path.join(TESTDIR, 'test-no-symlinks.hg'), 'test1')
--- a/tests/test-symlink-os-yes-fs-no.py.out	Sun Aug 08 23:10:08 2010 +0200
+++ b/tests/test-symlink-os-yes-fs-no.py.out	Mon Aug 09 16:08:33 2010 +0200
@@ -5,3 +5,10 @@
 added 1 changesets with 4 changes to 4 files
 updating to branch default
 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 4 changes to 4 files
+updating to branch default
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved