Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 35128:fd8b6b183073
hbisect: pass repo into hbisect.bisect
Pass repo into the bisect function to get more flexibility in what we can call.
This will allow us to use revsets to rewrite parts of the ancestor and children
calculation in later patches.
Test Plan:
python run-tests.py test-bisect*
Differential Revision: https://phab.mercurial-scm.org/D1497
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Thu, 23 Nov 2017 14:11:27 -0800 |
parents | e124e83fd159 |
children | ec25c8275cfa |
comparison
equal
deleted
inserted
replaced
35127:fa2395db68c6 | 35128:fd8b6b183073 |
---|---|
19 ) | 19 ) |
20 from . import ( | 20 from . import ( |
21 error, | 21 error, |
22 ) | 22 ) |
23 | 23 |
24 def bisect(changelog, state): | 24 def bisect(repo, state): |
25 """find the next node (if any) for testing during a bisect search. | 25 """find the next node (if any) for testing during a bisect search. |
26 returns a (nodes, number, good) tuple. | 26 returns a (nodes, number, good) tuple. |
27 | 27 |
28 'nodes' is the final result of the bisect if 'number' is 0. | 28 'nodes' is the final result of the bisect if 'number' is 0. |
29 Otherwise 'number' indicates the remaining possible candidates for | 29 Otherwise 'number' indicates the remaining possible candidates for |
30 the search and 'nodes' contains the next bisect target. | 30 the search and 'nodes' contains the next bisect target. |
31 'good' is True if bisect is searching for a first good changeset, False | 31 'good' is True if bisect is searching for a first good changeset, False |
32 if searching for a first bad one. | 32 if searching for a first bad one. |
33 """ | 33 """ |
34 | 34 |
35 changelog = repo.changelog | |
35 clparents = changelog.parentrevs | 36 clparents = changelog.parentrevs |
36 skip = set([changelog.rev(n) for n in state['skip']]) | 37 skip = set([changelog.rev(n) for n in state['skip']]) |
37 | 38 |
38 def buildancestors(bad, good): | 39 def buildancestors(bad, good): |
39 # only the earliest bad revision matters | 40 # only the earliest bad revision matters |