Mercurial > hg
changeset 16692:b9969574540a
largefiles: add --all-largefiles flag to pull
author | Na'Tosha Bard <natosha@unity3d.com> |
---|---|
date | Sat, 12 May 2012 11:45:22 +0200 |
parents | 7d6a660ca151 |
children | f1aa3010642f |
files | hgext/largefiles/overrides.py hgext/largefiles/uisetup.py tests/test-largefiles.t |
diffstat | 3 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sat May 12 09:59:01 2012 +0200 +++ b/hgext/largefiles/overrides.py Sat May 12 11:45:22 2012 +0200 @@ -651,6 +651,7 @@ # take some extra care so that the largefiles are correctly updated in the # working copy def overridepull(orig, ui, repo, source=None, **opts): + revsprepull = len(repo) if opts.get('rebase', False): repo._isrebasing = True try: @@ -660,7 +661,6 @@ 'the update flag\n') del opts['rebase'] cmdutil.bailifchanged(repo) - revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass @@ -695,6 +695,12 @@ (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 = [] + for rev in xrange(revsprepull + 1, revspostpull): + revs.append(repo[rev].rev()) + lfcommands.downloadlfiles(ui, repo, revs) return result def overrideclone(orig, ui, source, dest=None, **opts):
--- a/hgext/largefiles/uisetup.py Sat May 12 09:59:01 2012 +0200 +++ b/hgext/largefiles/uisetup.py Sat May 12 11:45:22 2012 +0200 @@ -70,6 +70,9 @@ overrides.overrideupdate) entry = extensions.wrapcommand(commands.table, 'pull', overrides.overridepull) + pullopt = [('', 'all-largefiles', None, + _('download all pulled versions of largefiles'))] + entry[1].extend(pullopt) entry = extensions.wrapcommand(commands.table, 'clone', overrides.overrideclone) cloneopt = [('', 'all-largefiles', None,
--- a/tests/test-largefiles.t Sat May 12 09:59:01 2012 +0200 +++ b/tests/test-largefiles.t Sat May 12 11:45:22 2012 +0200 @@ -444,6 +444,33 @@ 3 largefiles updated, 0 removed 8 additional largefiles cached +Test pulling with --all-largefiles 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 + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting changed largefiles + 2 largefiles updated, 0 removed + $ rm -Rf ${USERCACHE}/* + $ cd a-backup + $ hg pull --all-largefiles + 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) + caching new largefiles + 3 largefiles cached + 3 additional largefiles cached + $ cd .. + Rebasing between two repositories does not revert largefiles to old revisions (this was a very bad bug that took a lot of work to fix).