[PATCH STABLE] largefiles: use 'default' instead of 'default-push' when pulling (issue3584)

Matt Harbison matt_harbison at yahoo.com
Sun Oct 21 00:28:18 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1350783826 14400
# Branch stable
# Node ID 5a43200a76dcb2c77c4af1d812ac8c25ece1f75b
# Parent  b32e55e6c3c729c1eb0658a0c3bc109259bfdae6
largefiles: use 'default' instead of 'default-push' when pulling (issue3584)

This only applies to downloading largefiles, and only when no source for the
pull is explicitly provided.  The repository itself was properly being pulled
via 'default' previously.

Using --all-largefiles is not necessary on a bare pull to test this (this
existing test is merely a convenience), but it is required to test pulling on
the rebase path.

Note that the errors generated in the --rebase case are because the repo
specified doesn't have the largefiles in its cache (though they are in the user
cache), so the errors are misleading.  Specifying --all-largefiles when cloning
to 'b' fixes this, but instead of errors, it reports caching only 5 largefiles
instead of the 9 that come up missing.  Likely this is because the largefile
download procedure tries to download missing files for each rev, and some of the
files have standins in more than one rev that gets pulled.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -681,9 +681,9 @@
             def _dummy(*args, **kwargs):
                 pass
             commands.postincoming = _dummy
-            repo.lfpullsource = source
             if not source:
                 source = 'default'
+            repo.lfpullsource = source
             try:
                 result = commands.pull(ui, repo, source, **opts)
             finally:
@@ -694,9 +694,9 @@
         finally:
             repo._isrebasing = False
     else:
-        repo.lfpullsource = source
         if not source:
             source = 'default'
+        repo.lfpullsource = source
         oldheads = lfutil.getcurrentheads(repo)
         result = orig(ui, repo, source, **opts)
         # If we do not have the new largefiles for any new heads we pulled, we
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -765,7 +765,9 @@
   abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
   [255]
 
-Test pulling with --all-largefiles flag
+Test pulling with --all-largefiles flag.  Also test that the largefiles are
+downloaded from 'default' instead of 'default-push' when no source is specified
+(issue3584)
 
   $ rm -Rf a-backup
   $ hg clone -r 1 a a-backup
@@ -779,7 +781,7 @@
   2 largefiles updated, 0 removed
   $ rm "${USERCACHE}"/*
   $ cd a-backup
-  $ hg pull --all-largefiles
+  $ hg pull --all-largefiles --config paths.default-push=bogus/path
   pulling from $TESTTMP/a (glob)
   searching for changes
   adding changesets
@@ -821,8 +823,12 @@
   getting changed largefiles
   3 largefiles updated, 0 removed
   $ cd d
-  $ hg pull --rebase ../b
-  pulling from ../b
+
+More rebase testing, but also test that the largefiles are downloaded from
+'default' instead of 'default-push' when no source is specified (issue3584).
+The error messages go away if repo 'b' is created with --all-largefiles.
+  $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
+  pulling from $TESTTMP/b (glob)
   searching for changes
   adding changesets
   adding manifests
@@ -832,6 +838,26 @@
   M sub/normal4
   M sub2/large6
   saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
+  large3: can't get file locally
+  (no default or default-push path set in hgrc)
+  sub/large4: can't get file locally
+  (no default or default-push path set in hgrc)
+  large1: can't get file locally
+  (no default or default-push path set in hgrc)
+  sub/large2: can't get file locally
+  (no default or default-push path set in hgrc)
+  sub/large2: can't get file locally
+  (no default or default-push path set in hgrc)
+  large1: can't get file locally
+  (no default or default-push path set in hgrc)
+  sub/large2: can't get file locally
+  (no default or default-push path set in hgrc)
+  large1: can't get file locally
+  (no default or default-push path set in hgrc)
+  sub/large2: can't get file locally
+  (no default or default-push path set in hgrc)
+  0 additional largefiles cached
+  9 largefiles failed to download
   nothing to rebase
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
   9:598410d3eb9a  modify normal file largefile in repo d


More information about the Mercurial-devel mailing list