##// 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 # i18n: "contains" is a keyword
536 # i18n: "contains" is a keyword
537 pat = getstring(x, _("contains requires a pattern"))
537 pat = getstring(x, _("contains requires a pattern"))
538 s = []
538
539 if not matchmod.patkind(pat):
539 def matches(x):
540 pat = pathutil.canonpath(repo.root, repo.getcwd(), pat)
540 if not matchmod.patkind(pat):
541 for r in subset:
541 pats = pathutil.canonpath(repo.root, repo.getcwd(), pat)
542 if pat in repo[r]:
542 if pats in repo[x]:
543 s.append(r)
543 return True
544 else:
544 else:
545 m = None
545 c = repo[x]
546 for r in subset:
546 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
547 c = repo[r]
548 if not m or matchmod.patkind(pat) == 'set':
549 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
550 for f in c.manifest():
547 for f in c.manifest():
551 if m(f):
548 if m(f):
552 s.append(r)
549 return True
553 break
550 return False
554 return baseset(s)
551
552 return lazyset(subset, matches)
555
553
556 def converted(repo, subset, x):
554 def converted(repo, subset, x):
557 """``converted([id])``
555 """``converted([id])``
General Comments 0
You need to be logged in to leave comments. Login now