[PATCH 4 of 4 STABLE] largefiles: ensure addlargefiles() doesn't add a standin as a largefile

Matt Harbison matt_harbison at yahoo.com
Fri Jul 20 16:19:05 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1342755313 14400
# Node ID cedb84132c00a5d443913d741d9fd0925467ac49
# Parent  80c271cf1203be11aac9afa6326a4cefa857fb6e
largefiles: ensure addlargefiles() doesn't add a standin as a largefile

An easy way to force this (and cause a traceback) prior to the fix for 3507 was

  $ touch large
  $ hg add --large large
  $ hg ci -m "add"
  $ hg remove large
  $ touch large
  $ hg addremove --config largefiles.patterns=**large

This patch also detected (and corrected) a previous test where a standin got
added as a largefile (without a traceback).

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -81,7 +81,7 @@
                 ui.warn(_('%s already a largefile\n') % f)
             continue
 
-        if exact or not exists:
+        if (exact or not exists) and not lfutil.isstandin(f):
             wfile = repo.wjoin(f)
 
             # In case the file was removed previously, but not committed
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -383,7 +383,6 @@
   $ cd ..
   $ hg -R a addremove
   removing sub/large4
-  adding a/.hglf/testaddremove.dat as a largefile (glob)
   adding a/testaddremove.dat as a largefile (glob)
   removing normal3
   adding normaladdremove
@@ -489,6 +488,26 @@
   C sub2/large6
   C sub2/large7
 
+Test that a standin can't be added as a large file
+
+  $ touch large
+  $ hg add --large large
+  $ hg ci -m "add"
+  Invoking status precommit hook
+  A large
+  Invoking status postcommit hook
+  C large
+  C normal
+  C normal3
+  C sub/large4
+  C sub/normal4
+  C sub2/large6
+  C sub2/large7
+  $ hg remove large
+  $ touch large
+  $ hg addremove --config largefiles.patterns=**large --traceback
+  adding large as a largefile
+
   $ cd ../a
 
 Clone a largefiles repo.


More information about the Mercurial-devel mailing list