comparison mercurial/cmdutil.py @ 20364:a6cf48b2880d

revset: added baseset class (still empty) to improve revset performance This class is going to be used to cache the set that is created from this list in many cases while evaluating a revset.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Tue, 21 Jan 2014 11:39:26 -0800
parents 6d4fda48b4e3
children d4f804caa0ed
comparison
equal deleted inserted replaced
20363:e3ee7ec85a15 20364:a6cf48b2880d
1130 if opts.get('rev'): 1130 if opts.get('rev'):
1131 revs = scmutil.revrange(repo, opts.get('rev')) 1131 revs = scmutil.revrange(repo, opts.get('rev'))
1132 elif follow: 1132 elif follow:
1133 revs = repo.revs('reverse(:.)') 1133 revs = repo.revs('reverse(:.)')
1134 else: 1134 else:
1135 revs = list(repo) 1135 revs = revset.baseset(repo)
1136 revs.reverse() 1136 revs.reverse()
1137 if not revs: 1137 if not revs:
1138 return [] 1138 return []
1139 wanted = set() 1139 wanted = set()
1140 slowpath = match.anypats() or (match.files() and opts.get('removed')) 1140 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1141 fncache = {} 1141 fncache = {}
1142 change = repo.changectx 1142 change = repo.changectx
1143 revs = revset.baseset(revs)
1143 1144
1144 # First step is to fill wanted, the set of revisions that we want to yield. 1145 # First step is to fill wanted, the set of revisions that we want to yield.
1145 # When it does not induce extra cost, we also fill fncache for revisions in 1146 # When it does not induce extra cost, we also fill fncache for revisions in
1146 # wanted: a cache of filenames that were changed (ctx.files()) and that 1147 # wanted: a cache of filenames that were changed (ctx.files()) and that
1147 # match the file filtering conditions. 1148 # match the file filtering conditions.
1469 possiblyunsorted = True 1470 possiblyunsorted = True
1470 else: 1471 else:
1471 if follow and len(repo) > 0: 1472 if follow and len(repo) > 0:
1472 revs = repo.revs('reverse(:.)') 1473 revs = repo.revs('reverse(:.)')
1473 else: 1474 else:
1474 revs = list(repo.changelog) 1475 revs = revset.baseset(repo.changelog)
1475 revs.reverse() 1476 revs.reverse()
1476 if not revs: 1477 if not revs:
1477 return [], None, None 1478 return [], None, None
1479 revs = revset.baseset(revs)
1478 expr, filematcher = _makegraphlogrevset(repo, pats, opts, revs) 1480 expr, filematcher = _makegraphlogrevset(repo, pats, opts, revs)
1479 if possiblyunsorted: 1481 if possiblyunsorted:
1480 revs.sort(reverse=True) 1482 revs.sort(reverse=True)
1481 if expr: 1483 if expr:
1482 # Revset matchers often operate faster on revisions in changelog 1484 # Revset matchers often operate faster on revisions in changelog