Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 6750:fb42030d79d6
add __len__ and __iter__ methods to repo and revlog
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Jun 2008 14:35:50 -0500 |
parents | b3602c98c686 |
children | f67d1468ac50 |
comparison
equal
deleted
inserted
replaced
6749:51b0e799352f | 6750:fb42030d79d6 |
---|---|
18 def buildancestors(bad, good): | 18 def buildancestors(bad, good): |
19 # only the earliest bad revision matters | 19 # only the earliest bad revision matters |
20 badrev = min([changelog.rev(n) for n in bad]) | 20 badrev = min([changelog.rev(n) for n in bad]) |
21 goodrevs = [changelog.rev(n) for n in good] | 21 goodrevs = [changelog.rev(n) for n in good] |
22 # build ancestors array | 22 # build ancestors array |
23 ancestors = [[]] * (changelog.count() + 1) # an extra for [-1] | 23 ancestors = [[]] * (len(changelog) + 1) # an extra for [-1] |
24 | 24 |
25 # clear good revs from array | 25 # clear good revs from array |
26 for node in goodrevs: | 26 for node in goodrevs: |
27 ancestors[node] = None | 27 ancestors[node] = None |
28 for rev in xrange(changelog.count(), -1, -1): | 28 for rev in xrange(len(changelog), -1, -1): |
29 if ancestors[rev] is None: | 29 if ancestors[rev] is None: |
30 for prev in clparents(rev): | 30 for prev in clparents(rev): |
31 ancestors[prev] = None | 31 ancestors[prev] = None |
32 | 32 |
33 if ancestors[badrev] is None: | 33 if ancestors[badrev] is None: |