comparison hgext/largefiles/overrides.py @ 17602:ccd28eca37f6

merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 18 Sep 2012 16:19:56 -0500
parents 55724f42fa14 6e2ab601be3f
children 67deea9c1c42
comparison
equal deleted inserted replaced
17597:772b3764d3e8 17602:ccd28eca37f6
718 revs.append(repo[rev].rev()) 718 revs.append(repo[rev].rev())
719 lfcommands.downloadlfiles(ui, repo, revs) 719 lfcommands.downloadlfiles(ui, repo, revs)
720 return result 720 return result
721 721
722 def overrideclone(orig, ui, source, dest=None, **opts): 722 def overrideclone(orig, ui, source, dest=None, **opts):
723 if dest is None: 723 d = dest
724 dest = hg.defaultdest(source) 724 if d is None:
725 if opts.get('all_largefiles') and not hg.islocal(dest): 725 d = hg.defaultdest(source)
726 if opts.get('all_largefiles') and not hg.islocal(d):
726 raise util.Abort(_( 727 raise util.Abort(_(
727 '--all-largefiles is incompatible with non-local destination %s' % 728 '--all-largefiles is incompatible with non-local destination %s' %
728 dest)) 729 d))
729 result = hg.clone(ui, opts, source, dest, 730
730 pull=opts.get('pull'), 731 return orig(ui, source, dest, **opts)
731 stream=opts.get('uncompressed'), 732
732 rev=opts.get('rev'), 733 def hgclone(orig, ui, opts, *args, **kwargs):
733 update=True, # required for successful walkchangerevs 734 result = orig(ui, opts, *args, **kwargs)
734 branch=opts.get('branch')) 735
735 if result is None: 736 if result is not None and opts.get('all_largefiles'):
736 return True
737 if opts.get('all_largefiles'):
738 sourcerepo, destrepo = result 737 sourcerepo, destrepo = result
739 success, missing = lfcommands.downloadlfiles(ui, destrepo.local(), None) 738 repo = destrepo.local()
740 return missing != 0 739
741 return result is None 740 # The .hglf directory must exist for the standin matcher to match
741 # anything (which listlfiles uses for each rev), and .hg/largefiles is
742 # assumed to exist by the code that caches the downloaded file. These
743 # directories exist if clone updated to any rev.
744 if opts.get('noupdate'):
745 util.makedirs(repo.pathto(lfutil.shortname))
746 util.makedirs(repo.join(lfutil.longname))
747
748 # Caching is implicitly limited to 'rev' option, since the dest repo was
749 # truncated at that point.
750 success, missing = lfcommands.downloadlfiles(ui, repo, None)
751
752 if missing != 0:
753 return None
754
755 return result
742 756
743 def overriderebase(orig, ui, repo, **opts): 757 def overriderebase(orig, ui, repo, **opts):
744 repo._isrebasing = True 758 repo._isrebasing = True
745 try: 759 try:
746 return orig(ui, repo, **opts) 760 return orig(ui, repo, **opts)