Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 18463:07771e233cf1 stable
bisect: use changelog for iteration
With changelog filtering, we can not use xrange anymore. We have to use the
changelog to do the iteration. This way, the changelog excludes filtered
revision and we can safely use what we iterate over.
Without this changes, bisect crash with a traceback if there is filtered
revision in the repo. Tests have been updated.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 22 Jan 2013 03:23:02 +0100 |
parents | 93293813d753 |
children | 1e5b38a919dd 06ef32c3b4bb |
comparison
equal
deleted
inserted
replaced
18462:593eb3786165 | 18463:07771e233cf1 |
---|---|
36 ancestors = [None] * (len(changelog) + 1) # an extra for [-1] | 36 ancestors = [None] * (len(changelog) + 1) # an extra for [-1] |
37 | 37 |
38 # set nodes descended from goodrevs | 38 # set nodes descended from goodrevs |
39 for rev in goodrevs: | 39 for rev in goodrevs: |
40 ancestors[rev] = [] | 40 ancestors[rev] = [] |
41 for rev in xrange(goodrev + 1, len(changelog)): | 41 for rev in changelog.revs(goodrev + 1): |
42 for prev in clparents(rev): | 42 for prev in clparents(rev): |
43 if ancestors[prev] == []: | 43 if ancestors[prev] == []: |
44 ancestors[rev] = [] | 44 ancestors[rev] = [] |
45 | 45 |
46 # clear good revs from array | 46 # clear good revs from array |
47 for rev in goodrevs: | 47 for rev in goodrevs: |
48 ancestors[rev] = None | 48 ancestors[rev] = None |
49 for rev in xrange(len(changelog), goodrev, -1): | 49 for rev in changelog.revs(len(changelog), goodrev): |
50 if ancestors[rev] is None: | 50 if ancestors[rev] is None: |
51 for prev in clparents(rev): | 51 for prev in clparents(rev): |
52 ancestors[prev] = None | 52 ancestors[prev] = None |
53 | 53 |
54 if ancestors[badrev] is None: | 54 if ancestors[badrev] is None: |