Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/hbisect.py Mon Jan 21 19:40:15 2013 +0100 +++ b/mercurial/hbisect.py Tue Jan 22 03:23:02 2013 +0100 @@ -38,7 +38,7 @@ # set nodes descended from goodrevs for rev in goodrevs: ancestors[rev] = [] - for rev in xrange(goodrev + 1, len(changelog)): + for rev in changelog.revs(goodrev + 1): for prev in clparents(rev): if ancestors[prev] == []: ancestors[rev] = [] @@ -46,7 +46,7 @@ # clear good revs from array for rev in goodrevs: ancestors[rev] = None - for rev in xrange(len(changelog), goodrev, -1): + for rev in changelog.revs(len(changelog), goodrev): if ancestors[rev] is None: for prev in clparents(rev): ancestors[prev] = None