changeset 15147:395ca8cd2669

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 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 - but that are not in the bisection range. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
date Tue, 20 Sep 2011 20:21:04 +0200
parents b39d85be78a8
children 510184e5a09e
files mercurial/commands.py mercurial/hbisect.py mercurial/revset.py tests/test-bisect2.t
diffstat 4 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Sep 20 20:19:48 2011 +0200
+++ b/mercurial/commands.py	Tue Sep 20 20:21:04 2011 +0200
@@ -547,6 +547,8 @@
 
           hg log --graph -r "bisect(range)"
 
+      See :hg:`help revsets` for more about the `bisect()` keyword.
+
     Returns 0 on success.
     """
     def extendbisectrange(nodes, good):
--- a/mercurial/hbisect.py	Tue Sep 20 20:19:48 2011 +0200
+++ b/mercurial/hbisect.py	Tue Sep 20 20:21:04 2011 +0200
@@ -162,6 +162,7 @@
     - ``range``              : all csets taking part in the bisection
     - ``pruned``             : csets that are good, bad or skipped
     - ``untested``           : csets whose fate is yet unknown
+    - ``ignored``            : csets ignored due to DAG topology
     """
     state = load_state(repo)
     if status in ('good', 'bad', 'skip'):
@@ -191,12 +192,22 @@
         # 'untested' is all cset that are- in 'range', but not in 'pruned'
         untested = '( (%s) - (%s) )' % (range, pruned)
 
+        # 'ignored' is all csets that were not used during the bisection
+        # due to DAG topology, but may however have had an impact.
+        # Eg., a branch merged between bads and goods, but whose branch-
+        # point is out-side of the range.
+        iba = '::bisect(bad) - ::bisect(good)'  # Ignored bads' ancestors
+        iga = '::bisect(good) - ::bisect(bad)'  # Ignored goods' ancestors
+        ignored = '( ( (%s) | (%s) ) - (%s) )' % (iba, iga, range)
+
         if status == 'range':
             return [c.rev() for c in repo.set(range)]
         elif status == 'pruned':
             return [c.rev() for c in repo.set(pruned)]
         elif status == 'untested':
             return [c.rev() for c in repo.set(untested)]
+        elif status == 'ignored':
+            return [c.rev() for c in repo.set(ignored)]
 
         else:
             raise error.ParseError(_('invalid bisect state'))
--- a/mercurial/revset.py	Tue Sep 20 20:19:48 2011 +0200
+++ b/mercurial/revset.py	Tue Sep 20 20:21:04 2011 +0200
@@ -243,6 +243,7 @@
     - ``range``      : all csets taking part in the bisection
     - ``pruned``     : csets that are good, bad or skipped
     - ``untested``   : csets whose fate is yet unknown
+    - ``ignored``    : csets ignored due to DAG topology
     """
     status = getstring(x, _("bisect requires a string")).lower()
     return [r for r in subset if r in hbisect.get(repo, status)]
--- a/tests/test-bisect2.t	Tue Sep 20 20:19:48 2011 +0200
+++ b/tests/test-bisect2.t	Tue Sep 20 20:21:04 2011 +0200
@@ -270,6 +270,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
@@ -422,6 +423,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
@@ -463,6 +465,7 @@
   13:b0a32c86eb31
   15:857b178a7cf3
   16:609d82a7ebae
+  $ hg log -q -r 'bisect(ignored)'
 
 complex bisect test 4
 
@@ -560,6 +563,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
@@ -590,16 +601,38 @@
   16:609d82a7ebae
   17:228c06deef46
   $ hg log -q -r 'bisect(untested)'
+  $ 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)'
+  $ 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(untested)'
   9:3c77083deb4a
   10:429fcd26f52d
+  $ 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
@@ -628,6 +661,12 @@
   16:609d82a7ebae
   17:228c06deef46
   $ hg log -q -r 'bisect(untested)'
+  $ hg log -q -r 'bisect(ignored)'
+  2:051e12f87bf1
+  3:0950834f0a9c
+  4:5c668c22234f
+  5:385a529b6670
+  6:a214d5d3811a
 
 user adds irrelevant but consistent information (here: -g 2) to bisect state