debugstablerange: add a --verify flag to the command
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 24 Mar 2017 10:22:38 +0100
changeset 2232 6b95bcc402fe
parent 2231 f872738bb5b3
child 2233 e922cd76804a
debugstablerange: add a --verify flag to the command This should help us finding bugs.
hgext3rd/evolve/stablerange.py
tests/test-stablerange.t
--- a/hgext3rd/evolve/stablerange.py	Fri Mar 24 10:12:02 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Fri Mar 24 10:22:38 2017 +0100
@@ -161,6 +161,7 @@
     [
         ('', 'rev', [], 'operate on (rev, 0) ranges for rev in REVS'),
         ('', 'subranges', False, 'recursively display data for subranges too'),
+        ('', 'verify', False, 'checks subranges content (EXPENSIVE)'),
     ],
     _(''))
 def debugstablerange(ui, repo, **opts):
@@ -185,6 +186,7 @@
         ranges = [(r, 0) for r in revs]
     if ui.verbose:
         template = '%s-%d (%d, %d, %d)'
+
         def _rangestring(repo, rangeid):
             return template % (
                 short(node(rangeid[0])),
@@ -195,6 +197,7 @@
             )
     else:
         template = '%s-%d'
+
         def _rangestring(repo, rangeid):
             return template % (
                 short(node(rangeid[0])),
@@ -205,7 +208,19 @@
         subs = subranges(unfi, r)
         subsstr = ', '.join(_rangestring(unfi, s) for s in subs)
         rstr = _rangestring(unfi, r)
-        ui.status('%s - %s\n' % (rstr, subsstr))
+        if opts['verify']:
+            status = 'leaf'
+            if 1 < length(unfi, r):
+                status = 'complete'
+                revs = set(stablerange.revsfromrange(unfi, r))
+                subrevs = set()
+                for s in subs:
+                    subrevs.update(stablerange.revsfromrange(unfi, s))
+                if revs != subrevs:
+                    status = 'missing'
+            ui.status('%s [%s] - %s\n' % (rstr, status, subsstr))
+        else:
+            ui.status('%s - %s\n' % (rstr, subsstr))
 
 class stablerange(object):
 
--- a/tests/test-stablerange.t	Fri Mar 24 10:12:02 2017 +0100
+++ b/tests/test-stablerange.t	Fri Mar 24 10:22:38 2017 +0100
@@ -16,107 +16,107 @@
   $ hg init repo_linear
   $ cd repo_linear
   $ hg debugbuilddag '.+6'
-  $ hg debugstablerange --verbose --subranges --rev 1
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 1 > 1.range
+  $ hg debugstablerange --verify --verbose --subranges --rev 1
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 1 > 1.range
 
 bigger subset reuse most of the previous one
 
-  $ hg debugstablerange --verbose --subranges --rev 4
-  bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 4 > 4.range
+  $ hg debugstablerange --verify --verbose --subranges --rev 4
+  bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 4 > 4.range
   $ diff -u 1.range 4.range
   --- 1.range	* (glob)
   +++ 4.range	* (glob)
   @@ -1,3 +1,9 @@
-  +bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  +2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  +01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-  +2dc09a01254d-3 (3, 4, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-  +bebd167eb94d-4 (4, 5, 1) - 
+  +bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  +2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  +01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  +bebd167eb94d-4 (4, 5, 1) [leaf] - 
   [1]
 
 Using a range not ending on 2**N boundary
 we fall back on 2**N as much as possible
 
-  $ hg debugstablerange --verbose --subranges --rev 5
-  c8d03c1b5e94-0 (5, 6, 6) - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  c8d03c1b5e94-4 (5, 6, 2) - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  c8d03c1b5e94-5 (5, 6, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 5 > 5.range
+  $ hg debugstablerange --verify --verbose --subranges --rev 5
+  c8d03c1b5e94-0 (5, 6, 6) [complete] - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  c8d03c1b5e94-4 (5, 6, 2) [complete] - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  c8d03c1b5e94-5 (5, 6, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 5 > 5.range
   $ diff -u 4.range 5.range
   --- 4.range	* (glob)
   +++ 5.range	* (glob)
   @@ -1,9 +1,11 @@
-  -bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  +c8d03c1b5e94-0 (5, 6, 6) - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
-   2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-   2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  +c8d03c1b5e94-4 (5, 6, 2) - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
-   01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-   2dc09a01254d-3 (3, 4, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-   bebd167eb94d-4 (4, 5, 1) - 
-  +c8d03c1b5e94-5 (5, 6, 1) - 
+  -bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  +c8d03c1b5e94-0 (5, 6, 6) [complete] - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
+   2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+   2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  +c8d03c1b5e94-4 (5, 6, 2) [complete] - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
+   01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+   2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+   bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  +c8d03c1b5e94-5 (5, 6, 1) [leaf] - 
   [1]
 
 Even two unperfect range overlap a lot
 
-  $ hg debugstablerange --verbose --subranges --rev tip
-  f69452c5b1af-0 (6, 7, 7) - 2dc09a01254d-0 (3, 4, 4), f69452c5b1af-4 (6, 7, 3)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  f69452c5b1af-4 (6, 7, 3) - c8d03c1b5e94-4 (5, 6, 2), f69452c5b1af-6 (6, 7, 1)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  c8d03c1b5e94-4 (5, 6, 2) - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  c8d03c1b5e94-5 (5, 6, 1) - 
-  f69452c5b1af-6 (6, 7, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev tip > tip.range
+  $ hg debugstablerange --verify --verbose --subranges --rev tip
+  f69452c5b1af-0 (6, 7, 7) [complete] - 2dc09a01254d-0 (3, 4, 4), f69452c5b1af-4 (6, 7, 3)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  f69452c5b1af-4 (6, 7, 3) [complete] - c8d03c1b5e94-4 (5, 6, 2), f69452c5b1af-6 (6, 7, 1)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  c8d03c1b5e94-4 (5, 6, 2) [complete] - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  c8d03c1b5e94-5 (5, 6, 1) [leaf] - 
+  f69452c5b1af-6 (6, 7, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev tip > tip.range
   $ diff -u 5.range tip.range
   --- 5.range	* (glob)
   +++ tip.range	* (glob)
   @@ -1,5 +1,6 @@
-  -c8d03c1b5e94-0 (5, 6, 6) - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
-  +f69452c5b1af-0 (6, 7, 7) - 2dc09a01254d-0 (3, 4, 4), f69452c5b1af-4 (6, 7, 3)
-   2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +f69452c5b1af-4 (6, 7, 3) - c8d03c1b5e94-4 (5, 6, 2), f69452c5b1af-6 (6, 7, 1)
-   2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-   c8d03c1b5e94-4 (5, 6, 2) - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
+  -c8d03c1b5e94-0 (5, 6, 6) [complete] - 2dc09a01254d-0 (3, 4, 4), c8d03c1b5e94-4 (5, 6, 2)
+  +f69452c5b1af-0 (6, 7, 7) [complete] - 2dc09a01254d-0 (3, 4, 4), f69452c5b1af-4 (6, 7, 3)
+   2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +f69452c5b1af-4 (6, 7, 3) [complete] - c8d03c1b5e94-4 (5, 6, 2), f69452c5b1af-6 (6, 7, 1)
+   2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+   c8d03c1b5e94-4 (5, 6, 2) [complete] - bebd167eb94d-4 (4, 5, 1), c8d03c1b5e94-5 (5, 6, 1)
   @@ -9,3 +10,4 @@
-   66f7d451a68b-1 (1, 2, 1) - 
-   bebd167eb94d-4 (4, 5, 1) - 
-   c8d03c1b5e94-5 (5, 6, 1) - 
-  +f69452c5b1af-6 (6, 7, 1) - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+   bebd167eb94d-4 (4, 5, 1) [leaf] - 
+   c8d03c1b5e94-5 (5, 6, 1) [leaf] - 
+  +f69452c5b1af-6 (6, 7, 1) [leaf] - 
   [1]
 
   $ cd ..
@@ -161,123 +161,123 @@
 
 (left branch)
 
-  $ hg debugstablerange --verbose --subranges --rev 'left~2'
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'left~2' > left-2.range
-  $ hg debugstablerange --verbose --subranges --rev left
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'left' > left.range
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left~2'
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left~2' > left-2.range
+  $ hg debugstablerange --verify --verbose --subranges --rev left
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left' > left.range
   $ diff -u left-2.range left.range
   --- left-2.range	* (glob)
   +++ left.range	* (glob)
   @@ -1,3 +1,7 @@
-  +2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  +01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-  +2dc09a01254d-3 (3, 4, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
+  +2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  +01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
   [1]
 
 (right branch)
 
-  $ hg debugstablerange --verbose --subranges --rev right~2
-  e7bd5218ca15-0 (4, 2, 2) - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  e7bd5218ca15-1 (4, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'right~2' > right-2.range
-  $ hg debugstablerange --verbose --subranges --rev right
-  a2f58e9c1e56-0 (6, 4, 4) - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
-  a2f58e9c1e56-2 (6, 4, 2) - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
-  e7bd5218ca15-0 (4, 2, 2) - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  3a367db1fabc-2 (5, 3, 1) - 
-  a2f58e9c1e56-3 (6, 4, 1) - 
-  e7bd5218ca15-1 (4, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'right' > right.range
+  $ hg debugstablerange --verify --verbose --subranges --rev right~2
+  e7bd5218ca15-0 (4, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  e7bd5218ca15-1 (4, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'right~2' > right-2.range
+  $ hg debugstablerange --verify --verbose --subranges --rev right
+  a2f58e9c1e56-0 (6, 4, 4) [complete] - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
+  a2f58e9c1e56-2 (6, 4, 2) [complete] - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
+  e7bd5218ca15-0 (4, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  3a367db1fabc-2 (5, 3, 1) [leaf] - 
+  a2f58e9c1e56-3 (6, 4, 1) [leaf] - 
+  e7bd5218ca15-1 (4, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'right' > right.range
   $ diff -u right-2.range right.range
   --- right-2.range	* (glob)
   +++ right.range	* (glob)
   @@ -1,3 +1,7 @@
-  +a2f58e9c1e56-0 (6, 4, 4) - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
-  +a2f58e9c1e56-2 (6, 4, 2) - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
-   e7bd5218ca15-0 (4, 2, 2) - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
-   1ea73414a91b-0 (0, 1, 1) - 
-  +3a367db1fabc-2 (5, 3, 1) - 
-  +a2f58e9c1e56-3 (6, 4, 1) - 
-   e7bd5218ca15-1 (4, 2, 1) - 
+  +a2f58e9c1e56-0 (6, 4, 4) [complete] - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
+  +a2f58e9c1e56-2 (6, 4, 2) [complete] - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
+   e7bd5218ca15-0 (4, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +3a367db1fabc-2 (5, 3, 1) [leaf] - 
+  +a2f58e9c1e56-3 (6, 4, 1) [leaf] - 
+   e7bd5218ca15-1 (4, 2, 1) [leaf] - 
   [1]
 
 The merge reuse as much of the slicing created for one of the branch
 
-  $ hg debugstablerange --verbose --subranges --rev merge
-  5f18015f9110-0 (7, 8, 8) - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  5f18015f9110-4 (7, 8, 4) - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  3a367db1fabc-1 (5, 3, 2) - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
-  5f18015f9110-6 (7, 8, 2) - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  3a367db1fabc-2 (5, 3, 1) - 
-  5f18015f9110-7 (7, 8, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  a2f58e9c1e56-3 (6, 4, 1) - 
-  e7bd5218ca15-1 (4, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'merge' > merge.range
+  $ hg debugstablerange --verify --verbose --subranges --rev merge
+  5f18015f9110-0 (7, 8, 8) [complete] - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  5f18015f9110-4 (7, 8, 4) [complete] - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  3a367db1fabc-1 (5, 3, 2) [complete] - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
+  5f18015f9110-6 (7, 8, 2) [complete] - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  3a367db1fabc-2 (5, 3, 1) [leaf] - 
+  5f18015f9110-7 (7, 8, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  a2f58e9c1e56-3 (6, 4, 1) [leaf] - 
+  e7bd5218ca15-1 (4, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'merge' > merge.range
   $ diff -u left.range merge.range
   --- left.range	* (glob)
   +++ merge.range	* (glob)
   @@ -1,7 +1,15 @@
-  +5f18015f9110-0 (7, 8, 8) - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
-   2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +5f18015f9110-4 (7, 8, 4) - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
-   2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  +3a367db1fabc-1 (5, 3, 2) - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
-  +5f18015f9110-6 (7, 8, 2) - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-   01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-   2dc09a01254d-3 (3, 4, 1) - 
-  +3a367db1fabc-2 (5, 3, 1) - 
-  +5f18015f9110-7 (7, 8, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-  +a2f58e9c1e56-3 (6, 4, 1) - 
-  +e7bd5218ca15-1 (4, 2, 1) - 
+  +5f18015f9110-0 (7, 8, 8) [complete] - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
+   2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +5f18015f9110-4 (7, 8, 4) [complete] - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
+   2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  +3a367db1fabc-1 (5, 3, 2) [complete] - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
+  +5f18015f9110-6 (7, 8, 2) [complete] - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+   01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+   2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  +3a367db1fabc-2 (5, 3, 1) [leaf] - 
+  +5f18015f9110-7 (7, 8, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  +a2f58e9c1e56-3 (6, 4, 1) [leaf] - 
+  +e7bd5218ca15-1 (4, 2, 1) [leaf] - 
   [1]
   $ diff -u right.range merge.range
   --- right.range	* (glob)
   +++ merge.range	* (glob)
   @@ -1,7 +1,15 @@
-  -a2f58e9c1e56-0 (6, 4, 4) - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
-  -a2f58e9c1e56-2 (6, 4, 2) - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
-  -e7bd5218ca15-0 (4, 2, 2) - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
-  +5f18015f9110-0 (7, 8, 8) - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
-  +2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +5f18015f9110-4 (7, 8, 4) - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
-  +2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  +3a367db1fabc-1 (5, 3, 2) - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
-  +5f18015f9110-6 (7, 8, 2) - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
-  +66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  +01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-  +2dc09a01254d-3 (3, 4, 1) - 
-   3a367db1fabc-2 (5, 3, 1) - 
-  +5f18015f9110-7 (7, 8, 1) - 
-  +66f7d451a68b-1 (1, 2, 1) - 
-   a2f58e9c1e56-3 (6, 4, 1) - 
-   e7bd5218ca15-1 (4, 2, 1) - 
+  -a2f58e9c1e56-0 (6, 4, 4) [complete] - e7bd5218ca15-0 (4, 2, 2), a2f58e9c1e56-2 (6, 4, 2)
+  -a2f58e9c1e56-2 (6, 4, 2) [complete] - 3a367db1fabc-2 (5, 3, 1), a2f58e9c1e56-3 (6, 4, 1)
+  -e7bd5218ca15-0 (4, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), e7bd5218ca15-1 (4, 2, 1)
+  +5f18015f9110-0 (7, 8, 8) [complete] - 2dc09a01254d-0 (3, 4, 4), 5f18015f9110-4 (7, 8, 4)
+  +2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +5f18015f9110-4 (7, 8, 4) [complete] - 3a367db1fabc-1 (5, 3, 2), 5f18015f9110-6 (7, 8, 2)
+  +2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  +3a367db1fabc-1 (5, 3, 2) [complete] - e7bd5218ca15-1 (4, 2, 1), 3a367db1fabc-2 (5, 3, 1)
+  +5f18015f9110-6 (7, 8, 2) [complete] - a2f58e9c1e56-3 (6, 4, 1), 5f18015f9110-7 (7, 8, 1)
+  +66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  +01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   3a367db1fabc-2 (5, 3, 1) [leaf] - 
+  +5f18015f9110-7 (7, 8, 1) [leaf] - 
+  +66f7d451a68b-1 (1, 2, 1) [leaf] - 
+   a2f58e9c1e56-3 (6, 4, 1) [leaf] - 
+   e7bd5218ca15-1 (4, 2, 1) [leaf] - 
   [1]
   $ cd ..
 
@@ -332,79 +332,79 @@
 
 (left branch)
 
-  $ hg debugstablerange --verbose --subranges --rev 'left~2'
-  01241442b3c2-0 (2, 3, 3) - 66f7d451a68b-0 (1, 2, 2), 01241442b3c2-2 (2, 3, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'left~2' > left-2.range
-  $ hg debugstablerange --verbose --subranges --rev left
-  bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'left' > left.range
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left~2'
+  01241442b3c2-0 (2, 3, 3) [complete] - 66f7d451a68b-0 (1, 2, 2), 01241442b3c2-2 (2, 3, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left~2' > left-2.range
+  $ hg debugstablerange --verify --verbose --subranges --rev left
+  bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'left' > left.range
   $ diff -u left-2.range left.range
   --- left-2.range	* (glob)
   +++ left.range	* (glob)
   @@ -1,5 +1,9 @@
-  -01241442b3c2-0 (2, 3, 3) - 66f7d451a68b-0 (1, 2, 2), 01241442b3c2-2 (2, 3, 1)
-  +bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  +2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-   01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-  +2dc09a01254d-3 (3, 4, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-  +bebd167eb94d-4 (4, 5, 1) - 
+  -01241442b3c2-0 (2, 3, 3) [complete] - 66f7d451a68b-0 (1, 2, 2), 01241442b3c2-2 (2, 3, 1)
+  +bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  +2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+   01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  +bebd167eb94d-4 (4, 5, 1) [leaf] - 
   [1]
 
 (right branch)
 
-  $ hg debugstablerange --verbose --subranges --rev right~2
-  42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  42b07e8da27d-3 (7, 4, 1) - 
-  b9bc20507e0b-2 (6, 3, 1) - 
-  de561312eff4-1 (5, 2, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'right~2' > right-2.range
-  $ hg debugstablerange --verbose --subranges --rev right
-  f4b7da68b467-0 (9, 6, 6) - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
-  42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  42b07e8da27d-3 (7, 4, 1) - 
-  857477a9aebb-4 (8, 5, 1) - 
-  b9bc20507e0b-2 (6, 3, 1) - 
-  de561312eff4-1 (5, 2, 1) - 
-  f4b7da68b467-5 (9, 6, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'right' > right.range
+  $ hg debugstablerange --verify --verbose --subranges --rev right~2
+  42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+  de561312eff4-1 (5, 2, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'right~2' > right-2.range
+  $ hg debugstablerange --verify --verbose --subranges --rev right
+  f4b7da68b467-0 (9, 6, 6) [complete] - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
+  42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  857477a9aebb-4 (8, 5, 1) [leaf] - 
+  b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+  de561312eff4-1 (5, 2, 1) [leaf] - 
+  f4b7da68b467-5 (9, 6, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'right' > right.range
   $ diff -u right-2.range right.range
   --- right-2.range	* (glob)
   +++ right.range	* (glob)
   @@ -1,7 +1,11 @@
-  +f4b7da68b467-0 (9, 6, 6) - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
-   42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-   42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-   de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  +f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-   1ea73414a91b-0 (0, 1, 1) - 
-   42b07e8da27d-3 (7, 4, 1) - 
-  +857477a9aebb-4 (8, 5, 1) - 
-   b9bc20507e0b-2 (6, 3, 1) - 
-   de561312eff4-1 (5, 2, 1) - 
-  +f4b7da68b467-5 (9, 6, 1) - 
+  +f4b7da68b467-0 (9, 6, 6) [complete] - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
+   42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+   42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+   de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  +f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+   42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  +857477a9aebb-4 (8, 5, 1) [leaf] - 
+   b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+   de561312eff4-1 (5, 2, 1) [leaf] - 
+  +f4b7da68b467-5 (9, 6, 1) [leaf] - 
   [1]
 
 In this case, the bottom of the split will have multiple heads,
@@ -413,143 +413,143 @@
 
 We are still able to reuse one of the branch however
 
-  $ hg debugstablerange --verbose --subranges --rev merge
-  8aca7f8c9bd2-0 (10, 11, 11) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
-  bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  8aca7f8c9bd2-8 (10, 11, 3) - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  42b07e8da27d-3 (7, 4, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  857477a9aebb-4 (8, 5, 1) - 
-  8aca7f8c9bd2-10 (10, 11, 1) - 
-  b9bc20507e0b-2 (6, 3, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  de561312eff4-1 (5, 2, 1) - 
-  f4b7da68b467-5 (9, 6, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'merge' > merge.range
+  $ hg debugstablerange --verify --verbose --subranges --rev merge
+  8aca7f8c9bd2-0 (10, 11, 11) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
+  bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  8aca7f8c9bd2-8 (10, 11, 3) [complete] - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  857477a9aebb-4 (8, 5, 1) [leaf] - 
+  8aca7f8c9bd2-10 (10, 11, 1) [leaf] - 
+  b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  de561312eff4-1 (5, 2, 1) [leaf] - 
+  f4b7da68b467-5 (9, 6, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'merge' > merge.range
   $ diff -u left.range merge.range
   --- left.range	* (glob)
   +++ merge.range	* (glob)
   @@ -1,9 +1,21 @@
-  +8aca7f8c9bd2-0 (10, 11, 11) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
-   bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-   2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  +42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  +8aca7f8c9bd2-8 (10, 11, 3) - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
-   2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  +42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  +de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  +f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-   01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-   2dc09a01254d-3 (3, 4, 1) - 
-  +42b07e8da27d-3 (7, 4, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-  +857477a9aebb-4 (8, 5, 1) - 
-  +8aca7f8c9bd2-10 (10, 11, 1) - 
-  +b9bc20507e0b-2 (6, 3, 1) - 
-   bebd167eb94d-4 (4, 5, 1) - 
-  +de561312eff4-1 (5, 2, 1) - 
-  +f4b7da68b467-5 (9, 6, 1) - 
+  +8aca7f8c9bd2-0 (10, 11, 11) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
+   bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+   2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  +42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  +8aca7f8c9bd2-8 (10, 11, 3) [complete] - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
+   2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  +42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  +de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  +f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+   01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+   2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  +42b07e8da27d-3 (7, 4, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  +857477a9aebb-4 (8, 5, 1) [leaf] - 
+  +8aca7f8c9bd2-10 (10, 11, 1) [leaf] - 
+  +b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+   bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  +de561312eff4-1 (5, 2, 1) [leaf] - 
+  +f4b7da68b467-5 (9, 6, 1) [leaf] - 
   [1]
   $ diff -u right.range merge.range
   --- right.range	* (glob)
   +++ merge.range	* (glob)
   @@ -1,11 +1,21 @@
-  -f4b7da68b467-0 (9, 6, 6) - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
-  +8aca7f8c9bd2-0 (10, 11, 11) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
-  +bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  +2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-   42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  +8aca7f8c9bd2-8 (10, 11, 3) - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
-  +2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  +66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-   de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-   f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-  +01241442b3c2-2 (2, 3, 1) - 
-   1ea73414a91b-0 (0, 1, 1) - 
-  +2dc09a01254d-3 (3, 4, 1) - 
-   42b07e8da27d-3 (7, 4, 1) - 
-  +66f7d451a68b-1 (1, 2, 1) - 
-   857477a9aebb-4 (8, 5, 1) - 
-  +8aca7f8c9bd2-10 (10, 11, 1) - 
-   b9bc20507e0b-2 (6, 3, 1) - 
-  +bebd167eb94d-4 (4, 5, 1) - 
-   de561312eff4-1 (5, 2, 1) - 
-   f4b7da68b467-5 (9, 6, 1) - 
+  -f4b7da68b467-0 (9, 6, 6) [complete] - 42b07e8da27d-0 (7, 4, 4), f4b7da68b467-4 (9, 6, 2)
+  +8aca7f8c9bd2-0 (10, 11, 11) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
+  +bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  +2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+   42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  +8aca7f8c9bd2-8 (10, 11, 3) [complete] - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
+  +2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  +66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+   de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+   f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+  +01241442b3c2-2 (2, 3, 1) [leaf] - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  +2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  +66f7d451a68b-1 (1, 2, 1) [leaf] - 
+   857477a9aebb-4 (8, 5, 1) [leaf] - 
+  +8aca7f8c9bd2-10 (10, 11, 1) [leaf] - 
+   b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+  +bebd167eb94d-4 (4, 5, 1) [leaf] - 
+   de561312eff4-1 (5, 2, 1) [leaf] - 
+   f4b7da68b467-5 (9, 6, 1) [leaf] - 
   [1]
 
 Range above the merge, reuse subrange from the merge
 
-  $ hg debugstablerange --verbose --subranges --rev tip
-  e6b8d5b46647-0 (12, 13, 13) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), e6b8d5b46647-8 (12, 13, 5)
-  bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  e6b8d5b46647-8 (12, 13, 5) - 485383494a89-8 (11, 12, 4), e6b8d5b46647-12 (12, 13, 1)
-  2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-  42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  485383494a89-8 (11, 12, 4) - f4b7da68b467-4 (9, 6, 2), 485383494a89-10 (11, 12, 2)
-  2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-  42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  485383494a89-10 (11, 12, 2) - 8aca7f8c9bd2-10 (10, 11, 1), 485383494a89-11 (11, 12, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-  f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
-  01241442b3c2-2 (2, 3, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2dc09a01254d-3 (3, 4, 1) - 
-  42b07e8da27d-3 (7, 4, 1) - 
-  485383494a89-11 (11, 12, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  857477a9aebb-4 (8, 5, 1) - 
-  8aca7f8c9bd2-10 (10, 11, 1) - 
-  b9bc20507e0b-2 (6, 3, 1) - 
-  bebd167eb94d-4 (4, 5, 1) - 
-  de561312eff4-1 (5, 2, 1) - 
-  e6b8d5b46647-12 (12, 13, 1) - 
-  f4b7da68b467-5 (9, 6, 1) - 
-  $ hg debugstablerange --verbose --subranges --rev 'tip' > tip.range
+  $ hg debugstablerange --verify --verbose --subranges --rev tip
+  e6b8d5b46647-0 (12, 13, 13) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), e6b8d5b46647-8 (12, 13, 5)
+  bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  e6b8d5b46647-8 (12, 13, 5) [complete] - 485383494a89-8 (11, 12, 4), e6b8d5b46647-12 (12, 13, 1)
+  2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+  42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  485383494a89-8 (11, 12, 4) [complete] - f4b7da68b467-4 (9, 6, 2), 485383494a89-10 (11, 12, 2)
+  2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+  42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  485383494a89-10 (11, 12, 2) [complete] - 8aca7f8c9bd2-10 (10, 11, 1), 485383494a89-11 (11, 12, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+  f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+  01241442b3c2-2 (2, 3, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2dc09a01254d-3 (3, 4, 1) [leaf] - 
+  42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  485383494a89-11 (11, 12, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  857477a9aebb-4 (8, 5, 1) [leaf] - 
+  8aca7f8c9bd2-10 (10, 11, 1) [leaf] - 
+  b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+  bebd167eb94d-4 (4, 5, 1) [leaf] - 
+  de561312eff4-1 (5, 2, 1) [leaf] - 
+  e6b8d5b46647-12 (12, 13, 1) [leaf] - 
+  f4b7da68b467-5 (9, 6, 1) [leaf] - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'tip' > tip.range
   $ diff -u merge.range tip.range
   --- merge.range	* (glob)
   +++ tip.range	* (glob)
   @@ -1,10 +1,12 @@
-  -8aca7f8c9bd2-0 (10, 11, 11) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
-  +e6b8d5b46647-0 (12, 13, 13) - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), e6b8d5b46647-8 (12, 13, 5)
-   bebd167eb94d-0 (4, 5, 5) - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
-  +e6b8d5b46647-8 (12, 13, 5) - 485383494a89-8 (11, 12, 4), e6b8d5b46647-12 (12, 13, 1)
-   2dc09a01254d-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
-   42b07e8da27d-0 (7, 4, 4) - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
-  -8aca7f8c9bd2-8 (10, 11, 3) - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
-  +485383494a89-8 (11, 12, 4) - f4b7da68b467-4 (9, 6, 2), 485383494a89-10 (11, 12, 2)
-   2dc09a01254d-2 (3, 4, 2) - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
-   42b07e8da27d-2 (7, 4, 2) - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
-  +485383494a89-10 (11, 12, 2) - 8aca7f8c9bd2-10 (10, 11, 1), 485383494a89-11 (11, 12, 1)
-   66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-   de561312eff4-0 (5, 2, 2) - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
-   f4b7da68b467-4 (9, 6, 2) - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
+  -8aca7f8c9bd2-0 (10, 11, 11) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), 8aca7f8c9bd2-8 (10, 11, 3)
+  +e6b8d5b46647-0 (12, 13, 13) [complete] - bebd167eb94d-0 (4, 5, 5), 42b07e8da27d-0 (7, 4, 4), e6b8d5b46647-8 (12, 13, 5)
+   bebd167eb94d-0 (4, 5, 5) [complete] - 2dc09a01254d-0 (3, 4, 4), bebd167eb94d-4 (4, 5, 1)
+  +e6b8d5b46647-8 (12, 13, 5) [complete] - 485383494a89-8 (11, 12, 4), e6b8d5b46647-12 (12, 13, 1)
+   2dc09a01254d-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2dc09a01254d-2 (3, 4, 2)
+   42b07e8da27d-0 (7, 4, 4) [complete] - de561312eff4-0 (5, 2, 2), 42b07e8da27d-2 (7, 4, 2)
+  -8aca7f8c9bd2-8 (10, 11, 3) [complete] - f4b7da68b467-4 (9, 6, 2), 8aca7f8c9bd2-10 (10, 11, 1)
+  +485383494a89-8 (11, 12, 4) [complete] - f4b7da68b467-4 (9, 6, 2), 485383494a89-10 (11, 12, 2)
+   2dc09a01254d-2 (3, 4, 2) [complete] - 01241442b3c2-2 (2, 3, 1), 2dc09a01254d-3 (3, 4, 1)
+   42b07e8da27d-2 (7, 4, 2) [complete] - b9bc20507e0b-2 (6, 3, 1), 42b07e8da27d-3 (7, 4, 1)
+  +485383494a89-10 (11, 12, 2) [complete] - 8aca7f8c9bd2-10 (10, 11, 1), 485383494a89-11 (11, 12, 1)
+   66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+   de561312eff4-0 (5, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), de561312eff4-1 (5, 2, 1)
+   f4b7da68b467-4 (9, 6, 2) [complete] - 857477a9aebb-4 (8, 5, 1), f4b7da68b467-5 (9, 6, 1)
   @@ -12,10 +14,12 @@
-   1ea73414a91b-0 (0, 1, 1) - 
-   2dc09a01254d-3 (3, 4, 1) - 
-   42b07e8da27d-3 (7, 4, 1) - 
-  +485383494a89-11 (11, 12, 1) - 
-   66f7d451a68b-1 (1, 2, 1) - 
-   857477a9aebb-4 (8, 5, 1) - 
-   8aca7f8c9bd2-10 (10, 11, 1) - 
-   b9bc20507e0b-2 (6, 3, 1) - 
-   bebd167eb94d-4 (4, 5, 1) - 
-   de561312eff4-1 (5, 2, 1) - 
-  +e6b8d5b46647-12 (12, 13, 1) - 
-   f4b7da68b467-5 (9, 6, 1) - 
+   1ea73414a91b-0 (0, 1, 1) [leaf] - 
+   2dc09a01254d-3 (3, 4, 1) [leaf] - 
+   42b07e8da27d-3 (7, 4, 1) [leaf] - 
+  +485383494a89-11 (11, 12, 1) [leaf] - 
+   66f7d451a68b-1 (1, 2, 1) [leaf] - 
+   857477a9aebb-4 (8, 5, 1) [leaf] - 
+   8aca7f8c9bd2-10 (10, 11, 1) [leaf] - 
+   b9bc20507e0b-2 (6, 3, 1) [leaf] - 
+   bebd167eb94d-4 (4, 5, 1) [leaf] - 
+   de561312eff4-1 (5, 2, 1) [leaf] - 
+  +e6b8d5b46647-12 (12, 13, 1) [leaf] - 
+   f4b7da68b467-5 (9, 6, 1) [leaf] - 
   [1]
 
   $ cd ..
@@ -605,42 +605,42 @@
   |/
   o  0 1ea73414a91b r0
   
-  $ hg debugstablerange --verbose --subranges --rev 'head()'
-  1d8d22637c2d-0 (15, 8, 8) - 2b6d669947cd-0 (3, 4, 4), 1d8d22637c2d-4 (15, 8, 4)
-  dcbb326fdec2-0 (9, 7, 7) - 2b6d669947cd-0 (3, 4, 4), dcbb326fdec2-4 (9, 7, 3)
-  ff43616e5d0f-0 (10, 7, 7) - 2b6d669947cd-0 (3, 4, 4), ff43616e5d0f-4 (10, 7, 3)
-  b4594d867745-0 (13, 6, 6) - 2b6d669947cd-0 (3, 4, 4), b4594d867745-4 (13, 6, 2)
-  e46a4836065c-0 (12, 6, 6) - 2b6d669947cd-0 (3, 4, 4), e46a4836065c-4 (12, 6, 2)
-  2702dd0c91e7-0 (6, 5, 5) - f0f3ef9a6cd5-0 (5, 4, 4), 2702dd0c91e7-4 (6, 5, 1)
-  1d8d22637c2d-4 (15, 8, 4) - 4c748ffd1a46-2 (4, 3, 1), 43227190fef8-4 (14, 5, 1), 1d8d22637c2d-6 (15, 8, 2)
-  2b6d669947cd-0 (3, 4, 4) - 66f7d451a68b-0 (1, 2, 2), 2b6d669947cd-2 (3, 4, 2)
-  f0f3ef9a6cd5-0 (5, 4, 4) - fa942426a6fd-0 (2, 2, 2), f0f3ef9a6cd5-2 (5, 4, 2)
-  dcbb326fdec2-4 (9, 7, 3) - d62d843c9a01-4 (8, 6, 2), dcbb326fdec2-6 (9, 7, 1)
-  ff43616e5d0f-4 (10, 7, 3) - d62d843c9a01-4 (8, 6, 2), ff43616e5d0f-6 (10, 7, 1)
-  1d8d22637c2d-6 (15, 8, 2) - f0f3ef9a6cd5-3 (5, 4, 1), 1d8d22637c2d-7 (15, 8, 1)
-  2b6d669947cd-2 (3, 4, 2) - fa942426a6fd-1 (2, 2, 1), 2b6d669947cd-3 (3, 4, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  b4594d867745-4 (13, 6, 2) - bab5d5bf48bd-4 (11, 5, 1), b4594d867745-5 (13, 6, 1)
-  d62d843c9a01-4 (8, 6, 2) - e7d9710d9fc6-4 (7, 5, 1), d62d843c9a01-5 (8, 6, 1)
-  e46a4836065c-4 (12, 6, 2) - bab5d5bf48bd-4 (11, 5, 1), e46a4836065c-5 (12, 6, 1)
-  f0f3ef9a6cd5-2 (5, 4, 2) - 4c748ffd1a46-2 (4, 3, 1), f0f3ef9a6cd5-3 (5, 4, 1)
-  fa942426a6fd-0 (2, 2, 2) - 1ea73414a91b-0 (0, 1, 1), fa942426a6fd-1 (2, 2, 1)
-  1d8d22637c2d-7 (15, 8, 1) - 
-  1ea73414a91b-0 (0, 1, 1) - 
-  2702dd0c91e7-4 (6, 5, 1) - 
-  2b6d669947cd-3 (3, 4, 1) - 
-  43227190fef8-4 (14, 5, 1) - 
-  4c748ffd1a46-2 (4, 3, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  b4594d867745-5 (13, 6, 1) - 
-  bab5d5bf48bd-4 (11, 5, 1) - 
-  d62d843c9a01-5 (8, 6, 1) - 
-  dcbb326fdec2-6 (9, 7, 1) - 
-  e46a4836065c-5 (12, 6, 1) - 
-  e7d9710d9fc6-4 (7, 5, 1) - 
-  f0f3ef9a6cd5-3 (5, 4, 1) - 
-  fa942426a6fd-1 (2, 2, 1) - 
-  ff43616e5d0f-6 (10, 7, 1) - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'head()'
+  1d8d22637c2d-0 (15, 8, 8) [complete] - 2b6d669947cd-0 (3, 4, 4), 1d8d22637c2d-4 (15, 8, 4)
+  dcbb326fdec2-0 (9, 7, 7) [complete] - 2b6d669947cd-0 (3, 4, 4), dcbb326fdec2-4 (9, 7, 3)
+  ff43616e5d0f-0 (10, 7, 7) [complete] - 2b6d669947cd-0 (3, 4, 4), ff43616e5d0f-4 (10, 7, 3)
+  b4594d867745-0 (13, 6, 6) [complete] - 2b6d669947cd-0 (3, 4, 4), b4594d867745-4 (13, 6, 2)
+  e46a4836065c-0 (12, 6, 6) [complete] - 2b6d669947cd-0 (3, 4, 4), e46a4836065c-4 (12, 6, 2)
+  2702dd0c91e7-0 (6, 5, 5) [complete] - f0f3ef9a6cd5-0 (5, 4, 4), 2702dd0c91e7-4 (6, 5, 1)
+  1d8d22637c2d-4 (15, 8, 4) [complete] - 4c748ffd1a46-2 (4, 3, 1), 43227190fef8-4 (14, 5, 1), 1d8d22637c2d-6 (15, 8, 2)
+  2b6d669947cd-0 (3, 4, 4) [complete] - 66f7d451a68b-0 (1, 2, 2), 2b6d669947cd-2 (3, 4, 2)
+  f0f3ef9a6cd5-0 (5, 4, 4) [complete] - fa942426a6fd-0 (2, 2, 2), f0f3ef9a6cd5-2 (5, 4, 2)
+  dcbb326fdec2-4 (9, 7, 3) [complete] - d62d843c9a01-4 (8, 6, 2), dcbb326fdec2-6 (9, 7, 1)
+  ff43616e5d0f-4 (10, 7, 3) [complete] - d62d843c9a01-4 (8, 6, 2), ff43616e5d0f-6 (10, 7, 1)
+  1d8d22637c2d-6 (15, 8, 2) [complete] - f0f3ef9a6cd5-3 (5, 4, 1), 1d8d22637c2d-7 (15, 8, 1)
+  2b6d669947cd-2 (3, 4, 2) [complete] - fa942426a6fd-1 (2, 2, 1), 2b6d669947cd-3 (3, 4, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  b4594d867745-4 (13, 6, 2) [complete] - bab5d5bf48bd-4 (11, 5, 1), b4594d867745-5 (13, 6, 1)
+  d62d843c9a01-4 (8, 6, 2) [complete] - e7d9710d9fc6-4 (7, 5, 1), d62d843c9a01-5 (8, 6, 1)
+  e46a4836065c-4 (12, 6, 2) [complete] - bab5d5bf48bd-4 (11, 5, 1), e46a4836065c-5 (12, 6, 1)
+  f0f3ef9a6cd5-2 (5, 4, 2) [complete] - 4c748ffd1a46-2 (4, 3, 1), f0f3ef9a6cd5-3 (5, 4, 1)
+  fa942426a6fd-0 (2, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), fa942426a6fd-1 (2, 2, 1)
+  1d8d22637c2d-7 (15, 8, 1) [leaf] - 
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  2702dd0c91e7-4 (6, 5, 1) [leaf] - 
+  2b6d669947cd-3 (3, 4, 1) [leaf] - 
+  43227190fef8-4 (14, 5, 1) [leaf] - 
+  4c748ffd1a46-2 (4, 3, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  b4594d867745-5 (13, 6, 1) [leaf] - 
+  bab5d5bf48bd-4 (11, 5, 1) [leaf] - 
+  d62d843c9a01-5 (8, 6, 1) [leaf] - 
+  dcbb326fdec2-6 (9, 7, 1) [leaf] - 
+  e46a4836065c-5 (12, 6, 1) [leaf] - 
+  e7d9710d9fc6-4 (7, 5, 1) [leaf] - 
+  f0f3ef9a6cd5-3 (5, 4, 1) [leaf] - 
+  fa942426a6fd-1 (2, 2, 1) [leaf] - 
+  ff43616e5d0f-6 (10, 7, 1) [leaf] - 
   $ cd ..
 
 Tests range where a toprange is rooted on a merge
@@ -664,14 +664,14 @@
   |/
   o  0 1ea73414a91b r0
   
-  $ hg debugstablerange --verbose --subranges --rev 'head()'
-  f37e476fba9a-0 (4, 5, 5) - 66f7d451a68b-0 (1, 2, 2), 36315563e2fa-0 (3, 3, 3), f37e476fba9a-4 (4, 5, 1)
-  36315563e2fa-0 (3, 3, 3) - fa942426a6fd-0 (2, 2, 2), 36315563e2fa-2 (3, 3, 1)
-  66f7d451a68b-0 (1, 2, 2) - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
-  fa942426a6fd-0 (2, 2, 2) - 1ea73414a91b-0 (0, 1, 1), fa942426a6fd-1 (2, 2, 1)
-  1ea73414a91b-0 (0, 1, 1) - 
-  36315563e2fa-2 (3, 3, 1) - 
-  66f7d451a68b-1 (1, 2, 1) - 
-  f37e476fba9a-4 (4, 5, 1) - 
-  fa942426a6fd-1 (2, 2, 1) - 
+  $ hg debugstablerange --verify --verbose --subranges --rev 'head()'
+  f37e476fba9a-0 (4, 5, 5) [complete] - 66f7d451a68b-0 (1, 2, 2), 36315563e2fa-0 (3, 3, 3), f37e476fba9a-4 (4, 5, 1)
+  36315563e2fa-0 (3, 3, 3) [complete] - fa942426a6fd-0 (2, 2, 2), 36315563e2fa-2 (3, 3, 1)
+  66f7d451a68b-0 (1, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), 66f7d451a68b-1 (1, 2, 1)
+  fa942426a6fd-0 (2, 2, 2) [complete] - 1ea73414a91b-0 (0, 1, 1), fa942426a6fd-1 (2, 2, 1)
+  1ea73414a91b-0 (0, 1, 1) [leaf] - 
+  36315563e2fa-2 (3, 3, 1) [leaf] - 
+  66f7d451a68b-1 (1, 2, 1) [leaf] - 
+  f37e476fba9a-4 (4, 5, 1) [leaf] - 
+  fa942426a6fd-1 (2, 2, 1) [leaf] -