[PATCH] largefiles: fix symlink handling, with testcase

Carter, Eli Eli.Carter at tektronix.com
Wed Oct 26 13:09:46 CDT 2011


# HG changeset patch
# User Eli Carter <eli.carter at tektronix.com>
# Date 1319651981 18000
# Branch largefiles-bigsymlink-bug
# Node ID bf8520d4d7a0682b9699fd09bda009b4d1e467fa
# Parent  c1930992e1112f2bc0a6a38a84d43a34de72e180
largefiles: bugfix for symlink handling with testcase

diff -r c1930992e111 -r bf8520d4d7a0 hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Mon Oct 24 17:01:49 2011 -0500
+++ b/hgext/largefiles/overrides.py	Wed Oct 26 12:59:41 2011 -0500
@@ -87,6 +87,7 @@
 
         if exact or not exists:
             abovemin = (lfsize and
+                        not os.path.islink(repo.wjoin(f)) and
                         os.path.getsize(repo.wjoin(f)) >= lfsize * 1024 * 1024)
             if large or abovemin or (lfmatcher and lfmatcher(f)):
                 lfnames.append(f)
diff -r c1930992e111 -r bf8520d4d7a0 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Mon Oct 24 17:01:49 2011 -0500
+++ b/tests/test-largefiles.t	Wed Oct 26 12:59:41 2011 -0500
@@ -792,3 +792,26 @@
   1 largefiles updated, 0 removed
   $ cd ..
   $ HOME="$ORIGHOME"
+
+Symlink to a large largefile should behave the same as a symlink to a normal file
+  $ hg init largesymlink
+  $ cd largesymlink
+  $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
+  $ hg add --large largefile
+  $ hg commit -m "commit a large file"
+  $ ln -s largefile largelink
+  $ hg add largelink
+  $ hg commit -m "commit a large symlink"
+  $ rm -f largelink
+  $ hg up >/dev/null
+  $ test -e largelink
+  [1]
+  $ test -L largelink
+  [1]
+  $ rm -f largelink # make next part of the test independent of the previous
+  $ hg up -C >/dev/null
+  $ test -e largelink
+  $ test -L largelink
+  $ cd ..
+
+



More information about the Mercurial-devel mailing list