##// END OF EJS Templates
largefiles: refactor downloading of all largefiles to generic function
Na'Tosha Bard -
r16691:7d6a660c default
parent child Browse files
Show More
@@ -11,7 +11,8 b''
11 import os
11 import os
12 import shutil
12 import shutil
13
13
14 from mercurial import util, match as match_, hg, node, context, error, cmdutil
14 from mercurial import util, match as match_, hg, node, context, error, \
15 cmdutil, scmutil
15 from mercurial.i18n import _
16 from mercurial.i18n import _
16
17
17 import lfutil
18 import lfutil
@@ -400,6 +401,23 b' def cachelfiles(ui, repo, node):'
400
401
401 return ([], [])
402 return ([], [])
402
403
404 def downloadlfiles(ui, repo, rev=None):
405 matchfn = scmutil.match(repo[None],
406 [repo.wjoin(lfutil.shortname)], {})
407 def prepare(ctx, fns):
408 pass
409 totalsuccess = 0
410 totalmissing = 0
411 for ctx in cmdutil.walkchangerevs(repo, matchfn, {'rev' : rev},
412 prepare):
413 success, missing = cachelfiles(ui, repo, ctx.node())
414 totalsuccess += len(success)
415 totalmissing += len(missing)
416 ui.status(_("%d additional largefiles cached\n") % totalsuccess)
417 if totalmissing > 0:
418 ui.status(_("%d largefiles failed to download\n") % totalmissing)
419 return totalsuccess, totalmissing
420
403 def updatelfiles(ui, repo, filelist=None, printmessage=True):
421 def updatelfiles(ui, repo, filelist=None, printmessage=True):
404 wlock = repo.wlock()
422 wlock = repo.wlock()
405 try:
423 try:
@@ -706,23 +706,11 b' def overrideclone(orig, ui, source, dest'
706 branch=opts.get('branch'))
706 branch=opts.get('branch'))
707 if result is None:
707 if result is None:
708 return True
708 return True
709 totalsuccess = 0
710 totalmissing = 0
711 if opts.get('all_largefiles'):
709 if opts.get('all_largefiles'):
712 sourcerepo, destrepo = result
710 sourcerepo, destrepo = result
713 matchfn = scmutil.match(destrepo[None],
711 success, missing = lfcommands.downloadlfiles(ui, destrepo, None)
714 [destrepo.wjoin(lfutil.shortname)], {})
712 return missing != 0
715 def prepare(ctx, fns):
713 return result is None
716 pass
717 for ctx in cmdutil.walkchangerevs(destrepo, matchfn, {'rev' : None},
718 prepare):
719 success, missing = lfcommands.cachelfiles(ui, destrepo, ctx.node())
720 totalsuccess += len(success)
721 totalmissing += len(missing)
722 ui.status(_("%d additional largefiles cached\n") % totalsuccess)
723 if totalmissing > 0:
724 ui.status(_("%d largefiles failed to download\n") % totalmissing)
725 return totalmissing != 0
726
714
727 def overriderebase(orig, ui, repo, **opts):
715 def overriderebase(orig, ui, repo, **opts):
728 repo._isrebasing = True
716 repo._isrebasing = True
General Comments 0
You need to be logged in to leave comments. Login now