Show More
@@ -801,6 +801,21 b' def overridepull(orig, ui, repo, source=' | |||
|
801 | 801 | ui.status(_("%d largefiles cached\n") % numcached) |
|
802 | 802 | return result |
|
803 | 803 | |
|
804 | def overridepush(orig, ui, repo, *args, **kwargs): | |
|
805 | """Override push command and store --lfrev parameters in opargs""" | |
|
806 | lfrevs = kwargs.pop('lfrev', None) | |
|
807 | if lfrevs: | |
|
808 | opargs = kwargs.setdefault('opargs', {}) | |
|
809 | opargs['lfrevs'] = scmutil.revrange(repo, lfrevs) | |
|
810 | return orig(ui, repo, *args, **kwargs) | |
|
811 | ||
|
812 | def exchangepushoperation(orig, *args, **kwargs): | |
|
813 | """Override pushoperation constructor and store lfrevs parameter""" | |
|
814 | lfrevs = kwargs.pop('lfrevs', None) | |
|
815 | pushop = orig(*args, **kwargs) | |
|
816 | pushop.lfrevs = lfrevs | |
|
817 | return pushop | |
|
818 | ||
|
804 | 819 | revsetpredicate = registrar.revsetpredicate() |
|
805 | 820 | |
|
806 | 821 | @revsetpredicate('pulled()') |
@@ -353,10 +353,14 b' def reposetup(ui, repo):' | |||
|
353 | 353 | repo._lfstatuswriters = [ui.status] |
|
354 | 354 | |
|
355 | 355 | def prepushoutgoinghook(pushop): |
|
356 | if pushop.outgoing.missing: | |
|
356 | """Push largefiles for pushop before pushing revisions.""" | |
|
357 | lfrevs = pushop.lfrevs | |
|
358 | if lfrevs is None: | |
|
359 | lfrevs = pushop.outgoing.missing | |
|
360 | if lfrevs: | |
|
357 | 361 | toupload = set() |
|
358 | 362 | addfunc = lambda fn, lfhash: toupload.add(lfhash) |
|
359 |
lfutil.getlfilestoupload(pushop.repo, |
|
|
363 | lfutil.getlfilestoupload(pushop.repo, lfrevs, | |
|
360 | 364 | addfunc) |
|
361 | 365 | lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload) |
|
362 | 366 | repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook) |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | '''setup for largefiles extension: uisetup''' |
|
10 | 10 | |
|
11 | 11 | from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \ |
|
12 | httppeer, merge, scmutil, sshpeer, wireproto, subrepo, copies | |
|
12 | httppeer, merge, scmutil, sshpeer, wireproto, subrepo, copies, exchange | |
|
13 | 13 | from mercurial.i18n import _ |
|
14 | 14 | from mercurial.hgweb import hgweb_mod, webcommands |
|
15 | 15 | |
@@ -84,6 +84,14 b' def uisetup(ui):' | |||
|
84 | 84 | _('download largefiles for these revisions'), _('REV'))] |
|
85 | 85 | entry[1].extend(pullopt) |
|
86 | 86 | |
|
87 | entry = extensions.wrapcommand(commands.table, 'push', | |
|
88 | overrides.overridepush) | |
|
89 | pushopt = [('', 'lfrev', [], | |
|
90 | _('upload largefiles for these revisions'), _('REV'))] | |
|
91 | entry[1].extend(pushopt) | |
|
92 | entry = extensions.wrapfunction(exchange, 'pushoperation', | |
|
93 | overrides.exchangepushoperation) | |
|
94 | ||
|
87 | 95 | entry = extensions.wrapcommand(commands.table, 'clone', |
|
88 | 96 | overrides.overrideclone) |
|
89 | 97 | cloneopt = [('', 'all-largefiles', None, |
@@ -235,4 +235,20 b" Test coverage of 'missing from store':" | |||
|
235 | 235 | abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded) |
|
236 | 236 | [255] |
|
237 | 237 | |
|
238 | Verify that --lfrev controls which revisions are checked for largefiles to push | |
|
239 | ||
|
240 | $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip | |
|
241 | pushing to http://localhost:$HGPORT2/ | |
|
242 | searching for changes | |
|
243 | abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded) | |
|
244 | [255] | |
|
245 | ||
|
246 | $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null | |
|
247 | pushing to http://localhost:$HGPORT2/ | |
|
248 | searching for changes | |
|
249 | remote: adding changesets | |
|
250 | remote: adding manifests | |
|
251 | remote: adding file changes | |
|
252 | remote: added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
253 | ||
|
238 | 254 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now