Show More
@@ -963,7 +963,7 b' def overridearchive(orig, repo, dest, no' | |||
|
963 | 963 | if subrepos: |
|
964 | 964 | for subpath in sorted(ctx.substate): |
|
965 | 965 | sub = ctx.workingsub(subpath) |
|
966 |
submatch = match_. |
|
|
966 | submatch = match_.subdirmatcher(subpath, matchfn) | |
|
967 | 967 | sub._repo.lfstatus = True |
|
968 | 968 | sub.archive(archiver, prefix, submatch) |
|
969 | 969 | |
@@ -1011,7 +1011,7 b' def hgsubrepoarchive(orig, repo, archive' | |||
|
1011 | 1011 | |
|
1012 | 1012 | for subpath in sorted(ctx.substate): |
|
1013 | 1013 | sub = ctx.workingsub(subpath) |
|
1014 |
submatch = match_. |
|
|
1014 | submatch = match_.subdirmatcher(subpath, match) | |
|
1015 | 1015 | sub._repo.lfstatus = True |
|
1016 | 1016 | sub.archive(archiver, prefix + repo._path + '/', submatch) |
|
1017 | 1017 |
@@ -331,7 +331,7 b' def archive(repo, dest, node, kind, deco' | |||
|
331 | 331 | if subrepos: |
|
332 | 332 | for subpath in sorted(ctx.substate): |
|
333 | 333 | sub = ctx.workingsub(subpath) |
|
334 |
submatch = matchmod. |
|
|
334 | submatch = matchmod.subdirmatcher(subpath, matchfn) | |
|
335 | 335 | total += sub.archive(archiver, prefix, submatch) |
|
336 | 336 | |
|
337 | 337 | if total == 0: |
@@ -1142,7 +1142,7 b' def diffordiffstat(ui, repo, diffopts, n' | |||
|
1142 | 1142 | # node2 (inclusive). Thus, ctx2's substate won't contain that |
|
1143 | 1143 | # subpath. The best we can do is to ignore it. |
|
1144 | 1144 | tempnode2 = None |
|
1145 |
submatch = matchmod. |
|
|
1145 | submatch = matchmod.subdirmatcher(subpath, match) | |
|
1146 | 1146 | sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, |
|
1147 | 1147 | stat=stat, fp=fp, prefix=prefix) |
|
1148 | 1148 | |
@@ -2254,7 +2254,7 b' def add(ui, repo, match, prefix, explici' | |||
|
2254 | 2254 | for subpath in sorted(wctx.substate): |
|
2255 | 2255 | sub = wctx.sub(subpath) |
|
2256 | 2256 | try: |
|
2257 |
submatch = matchmod. |
|
|
2257 | submatch = matchmod.subdirmatcher(subpath, match) | |
|
2258 | 2258 | if opts.get('subrepos'): |
|
2259 | 2259 | bad.extend(sub.add(ui, submatch, prefix, False, **opts)) |
|
2260 | 2260 | else: |
@@ -2283,7 +2283,7 b' def forget(ui, repo, match, prefix, expl' | |||
|
2283 | 2283 | for subpath in sorted(wctx.substate): |
|
2284 | 2284 | sub = wctx.sub(subpath) |
|
2285 | 2285 | try: |
|
2286 |
submatch = matchmod. |
|
|
2286 | submatch = matchmod.subdirmatcher(subpath, match) | |
|
2287 | 2287 | subbad, subforgot = sub.forget(submatch, prefix) |
|
2288 | 2288 | bad.extend([subpath + '/' + f for f in subbad]) |
|
2289 | 2289 | forgot.extend([subpath + '/' + f for f in subforgot]) |
@@ -2340,7 +2340,7 b' def files(ui, ctx, m, fm, fmt, subrepos)' | |||
|
2340 | 2340 | if subrepos or matchessubrepo(subpath): |
|
2341 | 2341 | sub = ctx.sub(subpath) |
|
2342 | 2342 | try: |
|
2343 |
submatch = matchmod. |
|
|
2343 | submatch = matchmod.subdirmatcher(subpath, m) | |
|
2344 | 2344 | if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0: |
|
2345 | 2345 | ret = 0 |
|
2346 | 2346 | except error.LookupError: |
@@ -2369,7 +2369,7 b' def remove(ui, repo, m, prefix, after, f' | |||
|
2369 | 2369 | if subrepos or matchessubrepo(m, subpath): |
|
2370 | 2370 | sub = wctx.sub(subpath) |
|
2371 | 2371 | try: |
|
2372 |
submatch = matchmod. |
|
|
2372 | submatch = matchmod.subdirmatcher(subpath, m) | |
|
2373 | 2373 | if sub.removefiles(submatch, prefix, after, force, subrepos): |
|
2374 | 2374 | ret = 1 |
|
2375 | 2375 | except error.LookupError: |
@@ -2467,7 +2467,7 b' def cat(ui, repo, ctx, matcher, prefix, ' | |||
|
2467 | 2467 | for subpath in sorted(ctx.substate): |
|
2468 | 2468 | sub = ctx.sub(subpath) |
|
2469 | 2469 | try: |
|
2470 |
submatch = matchmod. |
|
|
2470 | submatch = matchmod.subdirmatcher(subpath, matcher) | |
|
2471 | 2471 | |
|
2472 | 2472 | if not sub.cat(submatch, os.path.join(prefix, sub._path), |
|
2473 | 2473 | **opts): |
@@ -365,7 +365,7 b' class basectx(object):' | |||
|
365 | 365 | # node1 and node2 (inclusive). Thus, ctx2's substate |
|
366 | 366 | # won't contain that subpath. The best we can do ignore it. |
|
367 | 367 | rev2 = None |
|
368 |
submatch = matchmod. |
|
|
368 | submatch = matchmod.subdirmatcher(subpath, match) | |
|
369 | 369 | s = sub.status(rev2, match=submatch, ignored=listignored, |
|
370 | 370 | clean=listclean, unknown=listunknown, |
|
371 | 371 | listsubrepos=True) |
@@ -334,13 +334,13 b' def badmatch(match, badfn):' | |||
|
334 | 334 | m.bad = badfn |
|
335 | 335 | return m |
|
336 | 336 | |
|
337 |
class |
|
|
337 | class subdirmatcher(match): | |
|
338 | 338 | """Adapt a matcher to work on a subdirectory only. |
|
339 | 339 | |
|
340 | 340 | The paths are remapped to remove/insert the path as needed: |
|
341 | 341 | |
|
342 | 342 | >>> m1 = match('root', '', ['a.txt', 'sub/b.txt']) |
|
343 |
>>> m2 = |
|
|
343 | >>> m2 = subdirmatcher('sub', m1) | |
|
344 | 344 | >>> bool(m2('a.txt')) |
|
345 | 345 | False |
|
346 | 346 | >>> bool(m2('b.txt')) |
@@ -913,7 +913,7 b' def addremove(repo, matcher, prefix, opt' | |||
|
913 | 913 | if opts.get('subrepos') or matchessubrepo(m, subpath): |
|
914 | 914 | sub = wctx.sub(subpath) |
|
915 | 915 | try: |
|
916 |
submatch = matchmod. |
|
|
916 | submatch = matchmod.subdirmatcher(subpath, m) | |
|
917 | 917 | if sub.addremove(submatch, prefix, opts, dry_run, similarity): |
|
918 | 918 | ret = 1 |
|
919 | 919 | except error.LookupError: |
@@ -774,7 +774,7 b' class hgsubrepo(abstractsubrepo):' | |||
|
774 | 774 | ctx = self._repo[rev] |
|
775 | 775 | for subpath in ctx.substate: |
|
776 | 776 | s = subrepo(ctx, subpath, True) |
|
777 |
submatch = matchmod. |
|
|
777 | submatch = matchmod.subdirmatcher(subpath, match) | |
|
778 | 778 | total += s.archive(archiver, prefix + self._path + '/', submatch) |
|
779 | 779 | return total |
|
780 | 780 |
General Comments 0
You need to be logged in to leave comments.
Login now