[PATCH 2 of 4 STABLE] largefiles: restore caching of largefiles with 'clone -U --all-largefiles'

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


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1347176258 14400
# Branch stable
# Node ID e72073a72d11a4874c396af4c03a394fa7d9ce42
# Parent  8af0b24124163aaa2ffc8a7245ea7bc923aa4889
largefiles: restore caching of largefiles with 'clone -U --all-largefiles'

This was broken when restoring normal -u and -U functionality.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -731,7 +731,19 @@
         return True
     if opts.get('all_largefiles'):
         sourcerepo, destrepo = result
-        success, missing = lfcommands.downloadlfiles(ui, destrepo.local(), None)
+        repo = destrepo.local()
+
+        # The .hglf directory must exist for the standin matcher to match
+        # anything (which listlfiles uses for each rev), and .hg/largefiles is
+        # assumed to exist by the code that caches the downloaded file.  These
+        # directories exist if clone updated to any rev.
+        if opts.get('noupdate'):
+            util.makedirs(repo.pathto(lfutil.shortname))
+            util.makedirs(repo.join(lfutil.longname))
+
+        # Caching is implicitly limited to 'rev' option, since the dest repo was
+        # truncated at that point.
+        success, missing = lfcommands.downloadlfiles(ui, repo, None)
         return missing != 0
     return result is None
 
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -682,7 +682,7 @@
 
   $ rm "${USERCACHE}"/*
   $ hg clone --all-largefiles -U a a-clone-u
-  0 additional largefiles cached
+  11 additional largefiles cached
   $ hg -R a-clone-u sum
   parent: -1:000000000000  (no revision checked out)
   branch: default


More information about the Mercurial-devel mailing list