largefiles: include 'largefiles' in converted repository requirements stable
authorEli Carter <eli.carter@tektronix.com>
Tue, 18 Oct 2011 16:40:59 -0500
branchstable
changeset 15303 07811b3b119b
parent 15302 225d30bacabd
child 15304 9aa9d4bb3d88
largefiles: include 'largefiles' in converted repository requirements
hgext/largefiles/lfcommands.py
tests/test-largefiles.t
--- a/hgext/largefiles/lfcommands.py	Tue Oct 18 17:09:03 2011 -0400
+++ 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(),
--- a/tests/test-largefiles.t	Tue Oct 18 17:09:03 2011 -0400
+++ b/tests/test-largefiles.t	Tue Oct 18 16:40:59 2011 -0500
@@ -661,3 +661,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
+