[PATCH 6 of 6] revset.bisected: add 'ignored' range to the bisected keyword

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sat Sep 17 15:27:34 CDT 2011


 mercurial/revset.py |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1316273957 -7200
# Node ID 5c5b9c8a2a16e226c9ba22c69eedfd35182b8841
# Parent  3f863165babc30f9217305329ec4ca6f50294c39
revset.bisected: add 'ignored' range to the bisected 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:
    (   ( ::bisected(bad) - ::bisected(good) )
      | ( ::bisected(good) - ::bisected(bad) ) )
    - bisected(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/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
     """
     state = getstring(x, _("bisect requires a string")).lower()
     bisectstate = hbisect.load_state(repo)
@@ -266,8 +267,11 @@
         for b in bads:
             ba |= set(repo.changelog.ancestors(b))
             bd |= set(repo.changelog.descendants(b))
-        # Build the range of the bisection (good::bad|bad::good)
-        range = set(c for c in ba if c in gd) | set(c for c in ga if c in bd)
+        # Build the range of the bisection
+        # - add bad ancestors that are good descendants
+        range  = set(c for c in ba if c in gd)
+        # - add good ancestors that are bad descendants
+        range |= set(c for c in ga if c in bd)
 
         if state == 'range':
             marked = [c for c in range]
@@ -279,6 +283,14 @@
             marked = [c for c in range if not (   c in goods
                                                or c in bads
                                                or c in skips)]
+        elif state == '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.extend([c for c in iga if not c in range])
 
         else:
             raise error.ParseError(_('invalid bisect state'))


More information about the Mercurial-devel mailing list