[PATCH] largefiles: fix requirements for converted repositories

Carter, Eli Eli.Carter at tektronix.com
Tue Oct 18 16:43:49 CDT 2011


This includes a testcase.

# HG changeset patch
# User Eli Carter <eli.carter at tektronix.com>
# Date 1318974059 18000
# Branch stable
# Node ID 3b136c0314a52b64db3c6afc6269805959b765fd
# Parent  56dbcfa77e25f19b7c0757d5a433775adf8ae43d
largefiles: include 'largefiles' in converted repository requirements

diff -r 56dbcfa77e25 -r 3b136c0314a5 hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py	Tue Oct 18 11:09:11 2011 -0500
+++ b/hgext/largefiles/lfcommands.py	Tue Oct 18 16:40:59 2011 -0500
@@ -109,6 +109,11 @@
                 except OSError:
                     pass
 
+            # If there were any files converted to largefiles, add largefiles
+            # to the destination repository's requirements.
+            if lfiles:
+                rdst.requirements.add('largefiles')
+                rdst._writerequirements()
         else:
             for ctx in ctxs:
                 ui.progress(_('converting revisions'), ctx.rev(),
diff -r 56dbcfa77e25 -r 3b136c0314a5 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Tue Oct 18 11:09:11 2011 -0500
+++ b/tests/test-largefiles.t	Tue Oct 18 16:40:59 2011 -0500
@@ -443,3 +443,27 @@
   large6-modified
   $ cat sub2/large7
   large7
+  $ cd ..
+
+Verify that lfconvert adds 'largefiles' to .hg/requires
+  $ hg init bigfile-repo
+  $ cd bigfile-repo
+  $ dd if=/dev/zero bs=1k count=23k > a-large-file 2> /dev/null
+  $ hg addremove
+  adding a-large-file
+  a-large-file: up to 72 MB of RAM may be required to manage this file
+  (use 'hg revert a-large-file' to cancel the pending addition)
+  $ hg commit -m "Commit file without making it be a largefile"
+  $ find .hg/largefiles
+  .hg/largefiles
+  $ cd ..
+  $ hg lfconvert --size 10 bigfile-repo largefiles-repo
+  initializing destination largefiles-repo
+  $ cat largefiles-repo/.hg/requires
+  largefiles
+  revlogv1
+  fncache
+  store
+  dotencode
+  $ rm -rf bigfile-repo largefiles-repo
+



More information about the Mercurial-devel mailing list