comparison mercurial/revset.py @ 16861:76bcd3eac67e

revset: implement dagrange directly This is much faster than the older implementation (~8x).
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 01 Jun 2012 15:50:22 -0700
parents e1aa1ed30030
children b6efeb27e733
comparison
equal deleted inserted replaced
16860:e1aa1ed30030 16861:76bcd3eac67e
190 r = range(m, n - 1, -1) 190 r = range(m, n - 1, -1)
191 s = set(subset) 191 s = set(subset)
192 return [x for x in r if x in s] 192 return [x for x in r if x in s]
193 193
194 def dagrange(repo, subset, x, y): 194 def dagrange(repo, subset, x, y):
195 return andset(repo, subset, 195 if subset:
196 ('func', ('symbol', 'descendants'), x), 196 r = range(len(repo))
197 ('func', ('symbol', 'ancestors'), y)) 197 m = getset(repo, r, x)
198 n = getset(repo, r, y)
199 cl = repo.changelog
200 xs = map(cl.rev, cl.nodesbetween(map(cl.node, m), map(cl.node, n))[0])
201 s = set(subset)
202 return [r for r in xs if r in s]
203 return []
198 204
199 def andset(repo, subset, x, y): 205 def andset(repo, subset, x, y):
200 return getset(repo, getset(repo, subset, x), y) 206 return getset(repo, getset(repo, subset, x), y)
201 207
202 def orset(repo, subset, x, y): 208 def orset(repo, subset, x, y):