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