diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1035,7 +1035,14 @@ def bisect( state = hbisect.load_state(repo) if rev: - nodes = [repo.changelog.node(i) for i in logcmdutil.revrange(repo, rev)] + revs = logcmdutil.revrange(repo, rev) + goodnodes = state[b'good'] + badnodes = state[b'bad'] + if goodnodes and badnodes: + candidates = repo.revs(b'(%ln)::(%ln)', goodnodes, badnodes) + candidates += repo.revs(b'(%ln)::(%ln)', badnodes, goodnodes) + revs = candidates & revs + nodes = [repo.changelog.node(i) for i in revs] else: nodes = [repo.lookup(b'.')] diff --git a/tests/test-bisect2.t b/tests/test-bisect2.t --- a/tests/test-bisect2.t +++ b/tests/test-bisect2.t @@ -784,7 +784,6 @@ user adds irrelevant but consistent info $ hg log -q -r 'bisect(pruned)' 0:33b1f9bc8bc5 1:4ca5088da217 - 2:051e12f87bf1 8:dab8161ac8fc 11:82ca6f06eccd 12:9f259202bbe7