##// END OF EJS Templates
revset: added lazyset implementation to contains revset
Lucas Moscovicz -
r20461:abd8e56a default
parent child Browse files
Show More
@@ -535,23 +535,21 b' def contains(repo, subset, x):'
535 535 """
536 536 # i18n: "contains" is a keyword
537 537 pat = getstring(x, _("contains requires a pattern"))
538 s = []
539 if not matchmod.patkind(pat):
540 pat = pathutil.canonpath(repo.root, repo.getcwd(), pat)
541 for r in subset:
542 if pat in repo[r]:
543 s.append(r)
544 else:
545 m = None
546 for r in subset:
547 c = repo[r]
548 if not m or matchmod.patkind(pat) == 'set':
549 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
538
539 def matches(x):
540 if not matchmod.patkind(pat):
541 pats = pathutil.canonpath(repo.root, repo.getcwd(), pat)
542 if pats in repo[x]:
543 return True
544 else:
545 c = repo[x]
546 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
550 547 for f in c.manifest():
551 548 if m(f):
552 s.append(r)
553 break
554 return baseset(s)
549 return True
550 return False
551
552 return lazyset(subset, matches)
555 553
556 554 def converted(repo, subset, x):
557 555 """``converted([id])``
General Comments 0
You need to be logged in to leave comments. Login now