mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
largefiles: introduce lfpull command for pulling missing largefiles
This commit is contained in:
parent
704d1b4d79
commit
8db31ff332
@ -49,6 +49,9 @@ when pulling is thus to use --update, which will update your working
|
||||
copy to the latest pulled revision (and thereby downloading any new
|
||||
largefiles).
|
||||
|
||||
If you want to pull largefiles you don't need for update yet, then
|
||||
you can use the `lfpull` command.
|
||||
|
||||
If you just want to ensure that you will have the largefiles needed to
|
||||
merge or rebase with new heads that you are pulling, then you can pull
|
||||
with `--cache-largefiles` flag to pre-emptively download any largefiles
|
||||
|
@ -530,6 +530,41 @@ def _updatelfile(repo, lfdirstate, lfile):
|
||||
lfdirstate.drop(lfile)
|
||||
return ret
|
||||
|
||||
def lfpull(ui, repo, source="default", **opts):
|
||||
"""pull largefiles for the specified revisions from the specified source
|
||||
|
||||
Pull largefiles that are referenced from local changesets but missing
|
||||
locally, pulling from a remote repository to the local cache.
|
||||
|
||||
If SOURCE is omitted, the 'default' path will be used.
|
||||
See :hg:`help urls` for more information.
|
||||
|
||||
.. container:: verbose
|
||||
|
||||
Some examples:
|
||||
|
||||
- pull largefiles for all branch heads::
|
||||
|
||||
hg lfpull -r "head() and not closed()"
|
||||
|
||||
- pull largefiles on the default branch::
|
||||
|
||||
hg lfpull -r "branch(default)"
|
||||
"""
|
||||
repo.lfpullsource = source
|
||||
|
||||
revs = opts.get('rev', [])
|
||||
if not revs:
|
||||
raise util.Abort(_('no revisions specified'))
|
||||
revs = scmutil.revrange(repo, revs)
|
||||
|
||||
numcached = 0
|
||||
for rev in revs:
|
||||
ui.note(_('pulling largefiles for revision %s\n') % rev)
|
||||
(cached, missing) = cachelfiles(ui, repo, rev)
|
||||
numcached += len(cached)
|
||||
ui.status(_("%d largefiles cached\n") % numcached)
|
||||
|
||||
# -- hg commands declarations ------------------------------------------------
|
||||
|
||||
cmdtable = {
|
||||
@ -542,6 +577,11 @@ cmdtable = {
|
||||
_('convert from a largefiles repo to a normal repo')),
|
||||
],
|
||||
_('hg lfconvert SOURCE DEST [FILE ...]')),
|
||||
'lfpull': (lfpull,
|
||||
[('r', 'rev', [], _('pull largefiles for these revisions'))
|
||||
] + commands.remoteopts,
|
||||
_('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]')
|
||||
),
|
||||
}
|
||||
|
||||
commands.inferrepo += " lfconvert"
|
||||
|
@ -912,6 +912,23 @@ downloaded from 'default' instead of 'default-push' when no source is specified
|
||||
added 6 changesets with 16 changes to 8 files
|
||||
(run 'hg update' to get a working copy)
|
||||
6 additional largefiles cached
|
||||
|
||||
lfpull
|
||||
|
||||
$ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
|
||||
2 largefiles cached
|
||||
$ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
|
||||
pulling largefiles for revision 4
|
||||
found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
|
||||
found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
|
||||
pulling largefiles for revision 2
|
||||
found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
|
||||
0 largefiles cached
|
||||
|
||||
$ ls usercache-lfpull/* | sort
|
||||
usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
|
||||
usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
|
||||
|
||||
$ cd ..
|
||||
|
||||
Rebasing between two repositories does not revert largefiles to old
|
||||
|
Loading…
Reference in New Issue
Block a user