changeset 2207:f82a398162f5

stablerange: fix a bug when a top slice ended on a merge Our "smart" detection of merge was buggy if the top slice ended on a merge. This is not fixed and tested.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 23 Mar 2017 14:16:43 +0100
parents 84537469a094
children 781ab704dc59
files hgext3rd/evolve/stablerange.py tests/test-stablerange.t
diffstat 2 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py	Thu Mar 23 10:49:03 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Thu Mar 23 14:16:43 2017 +0100
@@ -396,8 +396,8 @@
         self._revsinrangecache[top] = toprevs # update cache
         #
         rangedepth = self.depthrev(repo, rangeid[0])
-        toprootdepth = self.depthrev(repo, toprevs[0])
-        if toprootdepth + self.rangelength(repo, top) == rangedepth + 1:
+        maxbottomdepth = self.depthrev(repo, bottomrevs[-1])
+        if maxbottomdepth + self.rangelength(repo, top) == rangedepth:
             bheads = [bottomrevs[-1]]
         else:
             bheads = set(bottomrevs)
--- 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
+