changeset 15303:07811b3b119b stable

largefiles: include 'largefiles' in converted repository requirements
author Eli Carter <eli.carter@tektronix.com>
date Tue, 18 Oct 2011 16:40:59 -0500
parents 225d30bacabd
children 9aa9d4bb3d88
files hgext/largefiles/lfcommands.py tests/test-largefiles.t
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
+