--- a/tests/test-stablerange.t Thu Mar 23 10:49:03 2017 +0100
+++ b/tests/test-stablerange.t Thu Mar 23 14:16:43 2017 +0100
@@ -670,3 +670,37 @@
2 fa942426a6fd 1 1 2 000000000000
10 ff43616e5d0f 6 1 7 000000000000
$ cd ..
+
+Tests range where a toprange is rooted on a merge
+=================================================
+
+ $ hg init slice_on_merge
+ $ cd slice_on_merge
+ $ hg debugbuilddag '
+ > ..:a # 2 nodes, tagged "a"
+ > <2..:b # another branch with two node based on 0, tagged b
+ > *a/b:m # merge -1 and -2 (1, 2), tagged "m"
+ > '
+ $ hg log -G
+ o 4 f37e476fba9a r4 m tip
+ |\
+ | o 3 36315563e2fa r3 b
+ | |
+ | o 2 fa942426a6fd r2
+ | |
+ o | 1 66f7d451a68b r1 a
+ |/
+ o 0 1ea73414a91b r0
+
+ $ hg debugstablerange --rev 'head()'
+ rev node index size depth obshash
+ 4 f37e476fba9a 0 5 5 000000000000
+ 3 36315563e2fa 0 3 3 000000000000
+ 1 66f7d451a68b 0 2 2 000000000000
+ 2 fa942426a6fd 0 2 2 000000000000
+ 0 1ea73414a91b 0 1 1 000000000000
+ 3 36315563e2fa 2 1 3 000000000000
+ 1 66f7d451a68b 1 1 2 000000000000
+ 4 f37e476fba9a 4 1 5 000000000000
+ 2 fa942426a6fd 1 1 2 000000000000
+