[PATCH 1 of 4 STABLE] largefiles: restore normal 'clone -u' and 'clone -U' functionality

Matt Harbison matt_harbison at yahoo.com
Sun Sep 9 18:41:35 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1347125466 14400
# Branch stable
# Node ID 8af0b24124163aaa2ffc8a7245ea7bc923aa4889
# Parent  3ee5d3c372fabcf57c305835dac98da78bdc1837
largefiles: restore normal 'clone -u' and 'clone -U' functionality

Previously, tip would be checked out regardless of the -u or -U parameter.  I'm
not sure what the 'required for successful walkchangerevs' comment meant, but it
appears to reference code which has since moved to downloadlfiles() in
7d6a660ca151.  Perhaps it was to force caching when the -U parameter is given?
The price of this change is that -U --all-largefiles won't cache anything.  That
will be fixed next.

Note that X + Y in the 'X largefiles updated, n removed' and 'Y additional
largefiles cached' lines do not add up to the same values in these tests, but
all of the largefiles have been downloaded.  The reason being that several
largefiles have the same content (eb7338044 is pointed to by sub/large2, large3
and sub/large4).  In the 'clone -u 1' operation, this largefile is cached to
populate the working directory, even without --all-largefiles.  That means the
file isn't downloaded again and cached in the rev where large3 and sub/large4
both point to this file.  Downloading that one file in that one rev seems to be
counted twice with 'clone -u 0'.  (Maybe it is also being downloaded twice?)

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -725,7 +725,7 @@
                       pull=opts.get('pull'),
                       stream=opts.get('uncompressed'),
                       rev=opts.get('rev'),
-                      update=True, # required for successful walkchangerevs
+                      update=opts.get('updaterev') or not opts.get('noupdate'),
                       branch=opts.get('branch'))
     if result is None:
         return True
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -652,6 +652,43 @@
   3 largefiles updated, 0 removed
   8 additional largefiles cached
 
+  $ rm "${USERCACHE}"/*
+  $ hg clone --all-largefiles -u 0 a a-clone0
+  updating to branch default
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  2 largefiles updated, 0 removed
+  9 additional largefiles cached
+  $ hg -R a-clone0 sum
+  parent: 0:30d30fe6a5be 
+   add files
+  branch: default
+  commit: (clean)
+  update: 7 new changesets (update)
+
+  $ rm "${USERCACHE}"/*
+  $ hg clone --all-largefiles -u 1 a a-clone1
+  updating to branch default
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  2 largefiles updated, 0 removed
+  8 additional largefiles cached
+  $ hg -R a-clone1 sum
+  parent: 1:ce8896473775 
+   edit files
+  branch: default
+  commit: (clean)
+  update: 6 new changesets (update)
+
+  $ rm "${USERCACHE}"/*
+  $ hg clone --all-largefiles -U a a-clone-u
+  0 additional largefiles cached
+  $ hg -R a-clone-u sum
+  parent: -1:000000000000  (no revision checked out)
+  branch: default
+  commit: (clean)
+  update: 8 new changesets (update)
+
   $ hg clone --all-largefiles a ssh://localhost/a
   abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
   [255]


More information about the Mercurial-devel mailing list