Show More
@@ -720,25 +720,39 b' def overridepull(orig, ui, repo, source=' | |||||
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 |
d |
|
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 |
@@ -77,8 +77,9 b' def uisetup(ui):' | |||||
77 | overrides.overrideclone) |
|
77 | overrides.overrideclone) | |
78 | cloneopt = [('', 'all-largefiles', None, |
|
78 | cloneopt = [('', 'all-largefiles', None, | |
79 | _('download all versions of all largefiles'))] |
|
79 | _('download all versions of all largefiles'))] | |
|
80 | entry[1].extend(cloneopt) | |||
|
81 | entry = extensions.wrapfunction(hg, 'clone', overrides.hgclone) | |||
80 |
|
82 | |||
81 | entry[1].extend(cloneopt) |
|
|||
82 | entry = extensions.wrapcommand(commands.table, 'cat', |
|
83 | entry = extensions.wrapcommand(commands.table, 'cat', | |
83 | overrides.overridecat) |
|
84 | overrides.overridecat) | |
84 | entry = extensions.wrapfunction(merge, '_checkunknownfile', |
|
85 | entry = extensions.wrapfunction(merge, '_checkunknownfile', |
@@ -670,6 +670,59 b' Test cloning with --all-largefiles flag' | |||||
670 | 3 largefiles updated, 0 removed |
|
670 | 3 largefiles updated, 0 removed | |
671 | 8 additional largefiles cached |
|
671 | 8 additional largefiles cached | |
672 |
|
672 | |||
|
673 | $ rm "${USERCACHE}"/* | |||
|
674 | $ hg clone --all-largefiles -u 0 a a-clone0 | |||
|
675 | updating to branch default | |||
|
676 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
677 | getting changed largefiles | |||
|
678 | 2 largefiles updated, 0 removed | |||
|
679 | 9 additional largefiles cached | |||
|
680 | $ hg -R a-clone0 sum | |||
|
681 | parent: 0:30d30fe6a5be | |||
|
682 | add files | |||
|
683 | branch: default | |||
|
684 | commit: (clean) | |||
|
685 | update: 7 new changesets (update) | |||
|
686 | ||||
|
687 | $ rm "${USERCACHE}"/* | |||
|
688 | $ hg clone --all-largefiles -u 1 a a-clone1 | |||
|
689 | updating to branch default | |||
|
690 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
691 | getting changed largefiles | |||
|
692 | 2 largefiles updated, 0 removed | |||
|
693 | 8 additional largefiles cached | |||
|
694 | $ hg -R a-clone1 sum | |||
|
695 | parent: 1:ce8896473775 | |||
|
696 | edit files | |||
|
697 | branch: default | |||
|
698 | commit: (clean) | |||
|
699 | update: 6 new changesets (update) | |||
|
700 | ||||
|
701 | $ rm "${USERCACHE}"/* | |||
|
702 | $ hg clone --all-largefiles -U a a-clone-u | |||
|
703 | 11 additional largefiles cached | |||
|
704 | $ hg -R a-clone-u sum | |||
|
705 | parent: -1:000000000000 (no revision checked out) | |||
|
706 | branch: default | |||
|
707 | commit: (clean) | |||
|
708 | update: 8 new changesets (update) | |||
|
709 | ||||
|
710 | $ mkdir xyz | |||
|
711 | $ cd xyz | |||
|
712 | $ hg clone ../a | |||
|
713 | destination directory: a | |||
|
714 | updating to branch default | |||
|
715 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
716 | getting changed largefiles | |||
|
717 | 3 largefiles updated, 0 removed | |||
|
718 | $ cd .. | |||
|
719 | ||||
|
720 | Ensure base clone command argument validation | |||
|
721 | ||||
|
722 | $ hg clone -U -u 0 a a-clone-failure | |||
|
723 | abort: cannot specify both --noupdate and --updaterev | |||
|
724 | [255] | |||
|
725 | ||||
673 | $ hg clone --all-largefiles a ssh://localhost/a |
|
726 | $ hg clone --all-largefiles a ssh://localhost/a | |
674 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
727 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a | |
675 | [255] |
|
728 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now