Show More
@@ -95,7 +95,7 b' def perfaddremove(ui, repo):' | |||
|
95 | 95 | oldquiet = repo.ui.quiet |
|
96 | 96 | repo.ui.quiet = True |
|
97 | 97 | matcher = scmutil.match(repo[None]) |
|
98 | timer(lambda: scmutil.addremove(repo, matcher, dry_run=True)) | |
|
98 | timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True)) | |
|
99 | 99 | finally: |
|
100 | 100 | repo.ui.quiet = oldquiet |
|
101 | 101 | fm.end() |
@@ -1084,10 +1084,10 b' def overridesummary(orig, ui, repo, *pat' | |||
|
1084 | 1084 | finally: |
|
1085 | 1085 | repo.lfstatus = False |
|
1086 | 1086 | |
|
1087 | def scmutiladdremove(orig, repo, matcher, opts={}, dry_run=None, | |
|
1087 | def scmutiladdremove(orig, repo, matcher, prefix, opts={}, dry_run=None, | |
|
1088 | 1088 | similarity=None): |
|
1089 | 1089 | if not lfutil.islfilesrepo(repo): |
|
1090 | return orig(repo, matcher, opts, dry_run, similarity) | |
|
1090 | return orig(repo, matcher, prefix, opts, dry_run, similarity) | |
|
1091 | 1091 | # Get the list of missing largefiles so we can remove them |
|
1092 | 1092 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
1093 | 1093 | unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], |
@@ -1107,7 +1107,7 b' def scmutiladdremove(orig, repo, matcher' | |||
|
1107 | 1107 | # function to take care of the rest. Make sure it doesn't do anything with |
|
1108 | 1108 | # largefiles by passing a matcher that will ignore them. |
|
1109 | 1109 | matcher = composenormalfilematcher(matcher, repo[None].manifest()) |
|
1110 | return orig(repo, matcher, opts, dry_run, similarity) | |
|
1110 | return orig(repo, matcher, prefix, opts, dry_run, similarity) | |
|
1111 | 1111 | |
|
1112 | 1112 | # Calling purge with --all will cause the largefiles to be deleted. |
|
1113 | 1113 | # Override repo.status to prevent this from happening. |
@@ -2202,7 +2202,7 b' def commit(ui, repo, commitfunc, pats, o' | |||
|
2202 | 2202 | # extract addremove carefully -- this function can be called from a command |
|
2203 | 2203 | # that doesn't support addremove |
|
2204 | 2204 | if opts.get('addremove'): |
|
2205 | if scmutil.addremove(repo, matcher, opts) != 0: | |
|
2205 | if scmutil.addremove(repo, matcher, "", opts) != 0: | |
|
2206 | 2206 | raise util.Abort( |
|
2207 | 2207 | _("failed to mark all new/missing files as added/removed")) |
|
2208 | 2208 |
@@ -236,7 +236,7 b' def addremove(ui, repo, *pats, **opts):' | |||
|
236 | 236 | if sim < 0 or sim > 100: |
|
237 | 237 | raise util.Abort(_('similarity must be between 0 and 100')) |
|
238 | 238 | matcher = scmutil.match(repo[None], pats, opts) |
|
239 | return scmutil.addremove(repo, matcher, opts, similarity=sim / 100.0) | |
|
239 | return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) | |
|
240 | 240 | |
|
241 | 241 | @command('^annotate|blame', |
|
242 | 242 | [('r', 'rev', '', _('annotate the specified revision'), _('REV')), |
@@ -94,7 +94,9 b' Interaction with Mercurial Commands' | |||
|
94 | 94 | -S/--subrepos, or setting "ui.commitsubrepos=True" in a |
|
95 | 95 | configuration file (see :hg:`help config`). After there are no |
|
96 | 96 | longer any modified subrepositories, it records their state and |
|
97 | finally commits it in the parent repository. | |
|
97 | finally commits it in the parent repository. The --addremove | |
|
98 | option also honors the -S/--subrepos option. However, Git and | |
|
99 | Subversion subrepositories will print a warning and abort. | |
|
98 | 100 | |
|
99 | 101 | :diff: diff does not recurse in subrepos unless -S/--subrepos is |
|
100 | 102 | specified. Changes are displayed as usual, on the subrepositories |
@@ -713,13 +713,28 b' def matchfiles(repo, files):' | |||
|
713 | 713 | '''Return a matcher that will efficiently match exactly these files.''' |
|
714 | 714 | return matchmod.exact(repo.root, repo.getcwd(), files) |
|
715 | 715 | |
|
716 | def addremove(repo, matcher, opts={}, dry_run=None, similarity=None): | |
|
716 | def addremove(repo, matcher, prefix, opts={}, dry_run=None, similarity=None): | |
|
717 | 717 | m = matcher |
|
718 | 718 | if dry_run is None: |
|
719 | 719 | dry_run = opts.get('dry_run') |
|
720 | 720 | if similarity is None: |
|
721 | 721 | similarity = float(opts.get('similarity') or 0) |
|
722 | 722 | |
|
723 | ret = 0 | |
|
724 | join = lambda f: os.path.join(prefix, f) | |
|
725 | ||
|
726 | wctx = repo[None] | |
|
727 | for subpath in sorted(wctx.substate): | |
|
728 | if opts.get('subrepos'): | |
|
729 | sub = wctx.sub(subpath) | |
|
730 | try: | |
|
731 | submatch = matchmod.narrowmatcher(subpath, m) | |
|
732 | if sub.addremove(submatch, prefix, opts, dry_run, similarity): | |
|
733 | ret = 1 | |
|
734 | except error.LookupError: | |
|
735 | repo.ui.status(_("skipping missing subrepository: %s\n") | |
|
736 | % join(subpath)) | |
|
737 | ||
|
723 | 738 | rejected = [] |
|
724 | 739 | origbad = m.bad |
|
725 | 740 | def badfn(f, msg): |
@@ -737,9 +752,9 b' def addremove(repo, matcher, opts={}, dr' | |||
|
737 | 752 | for abs in sorted(toprint): |
|
738 | 753 | if repo.ui.verbose or not m.exact(abs): |
|
739 | 754 | if abs in unknownset: |
|
740 | status = _('adding %s\n') % m.uipath(abs) | |
|
755 | status = _('adding %s\n') % m.uipath(join(abs)) | |
|
741 | 756 | else: |
|
742 | status = _('removing %s\n') % m.uipath(abs) | |
|
757 | status = _('removing %s\n') % m.uipath(join(abs)) | |
|
743 | 758 | repo.ui.status(status) |
|
744 | 759 | |
|
745 | 760 | renames = _findrenames(repo, m, added + unknown, removed + deleted, |
@@ -751,7 +766,7 b' def addremove(repo, matcher, opts={}, dr' | |||
|
751 | 766 | for f in rejected: |
|
752 | 767 | if f in m.files(): |
|
753 | 768 | return 1 |
|
754 |
return |
|
|
769 | return ret | |
|
755 | 770 | |
|
756 | 771 | def marktouched(repo, files, similarity=0.0): |
|
757 | 772 | '''Assert that files have somehow been operated upon. files are relative to |
@@ -437,6 +437,10 b' class abstractsubrepo(object):' | |||
|
437 | 437 | def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly): |
|
438 | 438 | return [] |
|
439 | 439 | |
|
440 | def addremove(self, matcher, prefix, opts, dry_run, similarity): | |
|
441 | self._ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) | |
|
442 | return 1 | |
|
443 | ||
|
440 | 444 | def cat(self, ui, match, prefix, **opts): |
|
441 | 445 | return 1 |
|
442 | 446 | |
@@ -619,6 +623,11 b' class hgsubrepo(abstractsubrepo):' | |||
|
619 | 623 | return cmdutil.add(ui, self._repo, match, dryrun, listsubrepos, |
|
620 | 624 | os.path.join(prefix, self._path), explicitonly) |
|
621 | 625 | |
|
626 | def addremove(self, m, prefix, opts, dry_run, similarity): | |
|
627 | return scmutil.addremove(self._repo, m, | |
|
628 | os.path.join(prefix, self._path), opts, | |
|
629 | dry_run, similarity) | |
|
630 | ||
|
622 | 631 | @annotatesubrepoerror |
|
623 | 632 | def cat(self, ui, match, prefix, **opts): |
|
624 | 633 | rev = self._state[1] |
@@ -106,8 +106,8 b' Check that deep archiving works' | |||
|
106 | 106 | $ hg --config extensions.largefiles=! add sub1/sub2/test.txt |
|
107 | 107 | $ mkdir sub1/sub2/folder |
|
108 | 108 | $ echo 'subfolder' > sub1/sub2/folder/test.txt |
|
109 | $ hg --config extensions.largefiles=! add sub1/sub2/folder/test.txt | |
|
110 | $ hg ci -Sm "add test.txt" | |
|
109 | $ hg ci -ASm "add test.txt" | |
|
110 | adding sub1/sub2/folder/test.txt (glob) | |
|
111 | 111 | committing subrepository sub1 |
|
112 | 112 | committing subrepository sub1/sub2 (glob) |
|
113 | 113 | |
@@ -128,6 +128,15 b' Check that deep archiving works' | |||
|
128 | 128 | R sub1/.hgsubstate |
|
129 | 129 | R sub1/sub2/folder/test.txt |
|
130 | 130 | $ hg update -Cq |
|
131 | $ rm sub1/sub2/folder/test.txt | |
|
132 | $ rm sub1/sub2/test.txt | |
|
133 | $ hg ci -ASm "remove test.txt" | |
|
134 | removing sub1/sub2/folder/test.txt (glob) | |
|
135 | removing sub1/sub2/test.txt (glob) | |
|
136 | committing subrepository sub1 | |
|
137 | committing subrepository sub1/sub2 (glob) | |
|
138 | $ hg rollback -q | |
|
139 | $ hg up -Cq | |
|
131 | 140 | |
|
132 | 141 | $ hg --config extensions.largefiles=! archive -S ../archive_all |
|
133 | 142 | $ find ../archive_all | sort |
General Comments 0
You need to be logged in to leave comments.
Login now