diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py --- a/mercurial/hbisect.py +++ b/mercurial/hbisect.py @@ -160,6 +160,7 @@ def get(repo, status): - ``good``, ``bad``, ``skip``: as the names imply - ``range`` : all csets taking part in the bisection + - ``pruned`` : good|bad|skip, excluding out-of-range csets """ state = load_state(repo) if status in ('good', 'bad', 'skip'): @@ -190,6 +191,9 @@ def get(repo, status): if status == 'range': return [c for c in range] + elif status == 'pruned': + # We do not want skipped csets that are out-of-range + return [c for c in range if c in (goods | bads | skips)] else: raise error.ParseError(_('invalid bisect state')) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -241,6 +241,7 @@ def bisect(repo, subset, x): ``skip``), or any of the meta-status: - ``range`` : all csets taking part in the bisection + - ``pruned`` : good|bad|skip, excluding out-of-range csets """ status = getstring(x, _("bisect requires a string")).lower() return [r for r in subset if r in hbisect.get(repo, status)] diff --git a/tests/test-bisect2.t b/tests/test-bisect2.t --- a/tests/test-bisect2.t +++ b/tests/test-bisect2.t @@ -288,6 +288,14 @@ complex bisect test 1 # first bad rev i 15:857b178a7cf3 16:609d82a7ebae 17:228c06deef46 + $ hg log -q -r 'bisect(pruned)' + 0:33b1f9bc8bc5 + 6:a214d5d3811a + 8:dab8161ac8fc + 9:3c77083deb4a + 10:429fcd26f52d + 13:b0a32c86eb31 + 17:228c06deef46 complex bisect test 2 # first good rev is 13 @@ -327,6 +335,13 @@ complex bisect test 2 # first good rev 13:b0a32c86eb31 15:857b178a7cf3 18:d42e18c7bc9b + $ hg log -q -r 'bisect(pruned)' + 1:4ca5088da217 + 6:a214d5d3811a + 10:429fcd26f52d + 12:9f259202bbe7 + 13:b0a32c86eb31 + 18:d42e18c7bc9b complex bisect test 3 @@ -394,6 +409,15 @@ 10,9,13 are skipped an might be the firs 13:b0a32c86eb31 15:857b178a7cf3 16:609d82a7ebae + $ hg log -q -r 'bisect(pruned)' + 1:4ca5088da217 + 6:a214d5d3811a + 9:3c77083deb4a + 10:429fcd26f52d + 12:9f259202bbe7 + 13:b0a32c86eb31 + 15:857b178a7cf3 + 16:609d82a7ebae complex bisect test 4 @@ -443,6 +467,13 @@ 15,16 are skipped an might be the first 15:857b178a7cf3 16:609d82a7ebae 17:228c06deef46 + $ hg log -q -r 'bisect(pruned)' + 8:dab8161ac8fc + 10:429fcd26f52d + 13:b0a32c86eb31 + 15:857b178a7cf3 + 16:609d82a7ebae + 17:228c06deef46 test unrelated revs: @@ -452,6 +483,7 @@ test unrelated revs: abort: starting revisions are not directly related [255] $ hg log -q -r 'bisect(range)' + $ hg log -q -r 'bisect(pruned)' $ hg bisect --reset end at merge: 17 bad, 11 good (but 9 is first bad) @@ -483,6 +515,11 @@ end at merge: 17 bad, 11 good (but 9 is 15:857b178a7cf3 16:609d82a7ebae 17:228c06deef46 + $ hg log -q -r 'bisect(pruned)' + 11:82ca6f06eccd + 13:b0a32c86eb31 + 15:857b178a7cf3 + 17:228c06deef46 $ hg bisect --extend Extending search to changeset 8:dab8161ac8fc 2 files updated, 0 files merged, 2 files removed, 0 files unresolved @@ -506,6 +543,13 @@ end at merge: 17 bad, 11 good (but 9 is 15:857b178a7cf3 16:609d82a7ebae 17:228c06deef46 + $ hg log -q -r 'bisect(pruned)' + 8:dab8161ac8fc + 9:3c77083deb4a + 11:82ca6f06eccd + 13:b0a32c86eb31 + 15:857b178a7cf3 + 17:228c06deef46 user adds irrelevant but consistent information (here: -g 2) to bisect state @@ -530,3 +574,7 @@ user adds irrelevant but consistent info 11:82ca6f06eccd 12:9f259202bbe7 13:b0a32c86eb31 + $ hg log -q -r 'bisect(pruned)' + 8:dab8161ac8fc + 11:82ca6f06eccd + 13:b0a32c86eb31