largefiles: restore normal 'clone -u' and 'clone -U' functionality stable
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 08 Sep 2012 13:31:06 -0400
branchstable
changeset 17598 b7302d65006c
parent 17594 536fee6a5486
child 17599 56136786000f
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?)
hgext/largefiles/overrides.py
tests/test-largefiles.t
--- a/hgext/largefiles/overrides.py	Tue Sep 18 15:29:43 2012 +0200
+++ b/hgext/largefiles/overrides.py	Sat Sep 08 13:31:06 2012 -0400
@@ -730,7 +730,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
--- a/tests/test-largefiles.t	Tue Sep 18 15:29:43 2012 +0200
+++ b/tests/test-largefiles.t	Sat Sep 08 13:31:06 2012 -0400
@@ -670,6 +670,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]