comparison mercurial/revset.py @ 25549:f93ff3ab8d14

revset: mark spots that should use 'smartset.min()' Using smartset's min will be significantly faster when the input set can provided an optimised answer. I do not have time to fix all of them but I'm marking the spot.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 11 Jun 2015 14:26:44 -0700
parents 9584bcf27637
children 3e9049876ace
comparison
equal deleted inserted replaced
25548:9584bcf27637 25549:f93ff3ab8d14
56 else: 56 else:
57 cut = None 57 cut = None
58 58
59 def iterate(): 59 def iterate():
60 cl = repo.changelog 60 cl = repo.changelog
61 # XXX this should be 'parentset.min()' assuming 'parentset' is a
62 # smartset (and if it is not, it should.)
61 first = min(revs) 63 first = min(revs)
62 nullrev = node.nullrev 64 nullrev = node.nullrev
63 if first == nullrev: 65 if first == nullrev:
64 # Are there nodes with a null first parent and a non-null 66 # Are there nodes with a null first parent and a non-null
65 # second one? Maybe. Do we care? Probably not. 67 # second one? Maybe. Do we care? Probably not.
83 return baseset() 85 return baseset()
84 parentrevs = repo.changelog.parentrevs 86 parentrevs = repo.changelog.parentrevs
85 visit = list(heads) 87 visit = list(heads)
86 reachable = set() 88 reachable = set()
87 seen = {} 89 seen = {}
90 # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
91 # (and if it is not, it should.)
88 minroot = min(roots) 92 minroot = min(roots)
89 roots = set(roots) 93 roots = set(roots)
90 # open-code the post-order traversal due to the tiny size of 94 # open-code the post-order traversal due to the tiny size of
91 # sys.getrecursionlimit() 95 # sys.getrecursionlimit()
92 while visit: 96 while visit:
612 def _children(repo, narrow, parentset): 616 def _children(repo, narrow, parentset):
613 cs = set() 617 cs = set()
614 if not parentset: 618 if not parentset:
615 return baseset(cs) 619 return baseset(cs)
616 pr = repo.changelog.parentrevs 620 pr = repo.changelog.parentrevs
621 # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
622 # (and if it is not, it should.)
617 minrev = min(parentset) 623 minrev = min(parentset)
618 for r in narrow: 624 for r in narrow:
619 if r <= minrev: 625 if r <= minrev:
620 continue 626 continue
621 for p in pr(r): 627 for p in pr(r):
1215 # i18n: "branchpoint" is a keyword 1221 # i18n: "branchpoint" is a keyword
1216 getargs(x, 0, 0, _("branchpoint takes no arguments")) 1222 getargs(x, 0, 0, _("branchpoint takes no arguments"))
1217 cl = repo.changelog 1223 cl = repo.changelog
1218 if not subset: 1224 if not subset:
1219 return baseset() 1225 return baseset()
1226 # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
1227 # (and if it is not, it should.)
1220 baserev = min(subset) 1228 baserev = min(subset)
1221 parentscount = [0]*(len(repo) - baserev) 1229 parentscount = [0]*(len(repo) - baserev)
1222 for r in cl.revs(start=baserev + 1): 1230 for r in cl.revs(start=baserev + 1):
1223 for p in cl.parentrevs(r): 1231 for p in cl.parentrevs(r):
1224 if p >= baserev: 1232 if p >= baserev: