Comments
Patch
@@ -731,19 +731,21 @@
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
- # will run into a problem later if we try to merge or rebase with one of
- # these heads, so cache the largefiles now directly into the system
- # cache.
- numcached = 0
- heads = lfutil.getcurrentheads(repo)
- newheads = set(heads).difference(set(oldheads))
- if len(newheads) > 0:
- ui.status(_("caching largefiles for %s heads\n") % len(newheads))
- for head in newheads:
- (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
- numcached += len(cached)
- ui.status(_("%d largefiles cached\n") % numcached)
+ if not opts.get('no_largefiles_caching'):
+ # If we do not have the new largefiles for any new heads we
+ # pulled, we will run into a problem later if we try to merge
+ # or rebase with one of these heads, so cache the largefiles
+ # now directly into the system cache.
+ numcached = 0
+ heads = lfutil.getcurrentheads(repo)
+ newheads = set(heads).difference(set(oldheads))
+ if len(newheads) > 0:
+ ui.status(_("caching largefiles for %s heads\n") %
+ len(newheads))
+ for head in newheads:
+ (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
+ numcached += len(cached)
+ ui.status(_("%d largefiles cached\n") % numcached)
if opts.get('all_largefiles'):
revspostpull = len(repo)
revs = []
@@ -79,7 +79,9 @@
entry = extensions.wrapcommand(commands.table, 'pull',
overrides.overridepull)
pullopt = [('', 'all-largefiles', None,
- _('download all pulled versions of largefiles'))]
+ _('download all pulled versions of largefiles')),
+ ('', 'no-largefiles-caching', None,
+ _('do not cache largefiles for new heads'))]
entry[1].extend(pullopt)
entry = extensions.wrapcommand(commands.table, 'clone',
overrides.overrideclone)
@@ -859,6 +859,30 @@
abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
[255]
+Test pulling with the --no-largefiles-caching flag
+
+ $ rm -Rf a-backup
+ $ hg clone -r 1 a a-backup
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 8 changes to 4 files
+ updating to branch default
+ getting changed largefiles
+ 2 largefiles updated, 0 removed
+ 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ rm "${USERCACHE}"/*
+ $ cd a-backup
+ $ hg pull --no-largefiles-caching
+ pulling from $TESTTMP/a
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 6 changesets with 16 changes to 8 files
+ (run 'hg update' to get a working copy)
+ $ cd ..
+
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)