##// END OF EJS Templates
match: added matchessubrepo method to matcher...
Hannes Oldenburg -
r29758:2372182e default
parent child Browse files
Show More
@@ -2415,11 +2415,7 b' def files(ui, ctx, m, fm, fmt, subrepos)'
2415 ret = 0
2415 ret = 0
2416
2416
2417 for subpath in sorted(ctx.substate):
2417 for subpath in sorted(ctx.substate):
2418 def matchessubrepo(subpath):
2418 if subrepos or m.matchessubrepo(subpath):
2419 return (m.exact(subpath)
2420 or any(f.startswith(subpath + '/') for f in m.files()))
2421
2422 if subrepos or matchessubrepo(subpath):
2423 sub = ctx.sub(subpath)
2419 sub = ctx.sub(subpath)
2424 try:
2420 try:
2425 submatch = matchmod.subdirmatcher(subpath, m)
2421 submatch = matchmod.subdirmatcher(subpath, m)
@@ -2450,16 +2446,8 b' def remove(ui, repo, m, prefix, after, f'
2450 total = len(subs)
2446 total = len(subs)
2451 count = 0
2447 count = 0
2452 for subpath in subs:
2448 for subpath in subs:
2453 def matchessubrepo(matcher, subpath):
2454 if matcher.exact(subpath):
2455 return True
2456 for f in matcher.files():
2457 if f.startswith(subpath):
2458 return True
2459 return False
2460
2461 count += 1
2449 count += 1
2462 if subrepos or matchessubrepo(m, subpath):
2450 if subrepos or m.matchessubrepo(subpath):
2463 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2451 ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
2464
2452
2465 sub = wctx.sub(subpath)
2453 sub = wctx.sub(subpath)
@@ -320,6 +320,10 b' class match(object):'
320 kindpats.append((kind, pat, ''))
320 kindpats.append((kind, pat, ''))
321 return kindpats
321 return kindpats
322
322
323 def matchessubrepo(self, subpath):
324 return (self.exact(subpath)
325 or any(f.startswith(subpath + '/') for f in self.files()))
326
323 def exact(root, cwd, files, badfn=None):
327 def exact(root, cwd, files, badfn=None):
324 return match(root, cwd, files, exact=True, badfn=badfn)
328 return match(root, cwd, files, exact=True, badfn=badfn)
325
329
@@ -948,17 +948,9 b' def addremove(repo, matcher, prefix, opt'
948 ret = 0
948 ret = 0
949 join = lambda f: os.path.join(prefix, f)
949 join = lambda f: os.path.join(prefix, f)
950
950
951 def matchessubrepo(matcher, subpath):
952 if matcher.exact(subpath):
953 return True
954 for f in matcher.files():
955 if f.startswith(subpath):
956 return True
957 return False
958
959 wctx = repo[None]
951 wctx = repo[None]
960 for subpath in sorted(wctx.substate):
952 for subpath in sorted(wctx.substate):
961 if opts.get('subrepos') or matchessubrepo(m, subpath):
953 if opts.get('subrepos') or m.matchessubrepo(subpath):
962 sub = wctx.sub(subpath)
954 sub = wctx.sub(subpath)
963 try:
955 try:
964 submatch = matchmod.subdirmatcher(subpath, m)
956 submatch = matchmod.subdirmatcher(subpath, m)
General Comments 0
You need to be logged in to leave comments. Login now