[PATCH 7 of 9] revset.bisect: add 'ignored' set to the bisect keyword

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sun Sep 18 18:31:18 CDT 2011


 mercurial/hbisect.py |  10 ++++++++++
 mercurial/revset.py  |   1 +
 tests/test-bisect2.t |  34 ++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1316273957 -7200
# Node ID 9f87db4abda16053574f4c96b41a31a154c47685
# Parent  0c84cac333c65fc9872160a197b25c088fa8e241
revset.bisect: add 'ignored' set to the bisect keyword

The 'ignored' changesets are outside the bisection range, but are
changesets that may have an impact on the outcome of the bisection.

For example, in case there's a merge between the good and bad csets,
but the branch-point is out of the bisection range, and the issue
originates from this branch, the branch will not be visited by bisect
and bisect will find that the culprit cset is the merge.

So, the 'ignored' set is roughly equivalent to:
    (   ( ::bisect(bad) - ::bisect(good) )
      | ( ::bisect(good) - ::bisect(bad) ) )
    - bisect(range)

 - all ancestors of bad csets that are not ancestors of good csets, or
 - all ancestors of good csets that are not ancestors of bad csets
 - and that are not in the bisection range.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>

diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -162,6 +162,7 @@
     - ``range``              : all csets taking part in the bisection
     - ``pruned``             : good|bad|skip, excluding out-of-range csets
     - ``untested``           : csets whose fate is yet unknown
+    - ``ignored``            : csets ignored due to DAG topology
     """
     state = load_state(repo)
     if status in ('good', 'bad', 'skip'):
@@ -198,6 +199,15 @@
         elif status == 'untested':
             # Return the csets in range that are not pruned
             return [c for c in range if not c in (goods | bads | skips)]
+        elif status == 'ignored':
+            # Ignored bad ancestors
+            iba = set(c for c in ba if not c in ga)
+            # Ignored good ancestors
+            iga = set(c for c in ga if not c in ba)
+            # Add ignored changesets that are not in the range
+            marked  = [c for c in iba if not c in range]
+            marked += [c for c in iga if not c in range]
+            return marked
 
         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
@@ -243,6 +243,7 @@
     - ``range``      : all csets taking part in the bisection
     - ``pruned``     : good|bad|skip, excluding out-of-range csets
     - ``untested``   : csets whose fate is yet unknown
+    - ``ignored``    : csets ignored by the bisection due to topology
     """
     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
@@ -267,6 +267,7 @@
   13:b0a32c86eb31
   15:857b178a7cf3
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
   $ hg bisect -g      # -> update to rev 13
   Testing changeset 13:b0a32c86eb31 (9 changesets remaining, ~3 tests)
   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -321,6 +322,7 @@
   12:9f259202bbe7
   15:857b178a7cf3
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
 
 complex bisect test 2  # first good rev is 13
 
@@ -404,6 +406,7 @@
   $ hg bisect -s      # -> update to rev 15
   Testing changeset 15:857b178a7cf3 (5 changesets remaining, ~2 tests)
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -q -r 'bisect(ignored)'
   $ hg bisect -b
   Due to skipped revisions, the first bad revision could be any of:
   changeset:   9:3c77083deb4a
@@ -454,6 +457,7 @@
   13:b0a32c86eb31
   15:857b178a7cf3
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
 
 complex bisect test 4
 
@@ -529,6 +533,14 @@
   $ hg bisect -g 11
   Testing changeset 13:b0a32c86eb31 (5 changesets remaining, ~2 tests)
   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -q -r 'bisect(ignored)'
+  2:051e12f87bf1
+  3:0950834f0a9c
+  4:5c668c22234f
+  5:385a529b6670
+  6:a214d5d3811a
+  9:3c77083deb4a
+  10:429fcd26f52d
   $ hg bisect -g
   Testing changeset 15:857b178a7cf3 (3 changesets remaining, ~1 tests)
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -559,15 +571,37 @@
   $ hg log -q -r 'bisect(untested)'
   12:9f259202bbe7
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
+  2:051e12f87bf1
+  3:0950834f0a9c
+  4:5c668c22234f
+  5:385a529b6670
+  6:a214d5d3811a
+  9:3c77083deb4a
+  10:429fcd26f52d
   $ hg bisect --extend
   Extending search to changeset 8:dab8161ac8fc
   2 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg log -q -r 'bisect(untested)'
   12:9f259202bbe7
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
+  2:051e12f87bf1
+  3:0950834f0a9c
+  4:5c668c22234f
+  5:385a529b6670
+  6:a214d5d3811a
+  9:3c77083deb4a
+  10:429fcd26f52d
   $ hg bisect -g # dab8161ac8fc
   Testing changeset 9:3c77083deb4a (3 changesets remaining, ~1 tests)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -q -r 'bisect(ignored)'
+  2:051e12f87bf1
+  3:0950834f0a9c
+  4:5c668c22234f
+  5:385a529b6670
+  6:a214d5d3811a
   $ hg bisect -b
   The first bad revision is:
   changeset:   9:3c77083deb4a


More information about the Mercurial-devel mailing list