# HG changeset patch # User Pierre-Yves David # Date 1506766264 -3600 # Node ID 0884856a4143a7d18dcd09c9bfcb9686806094fa # Parent 081070828703ac44fadbb6d5556f600cac7efbf2 stack: handle basic case of splitting with crash hg stack used to crash horribly whenever a split was encountered. This is no longer the case. If the result of the split (or there successors) produce a sensible linear result with on final head, we can just assume that head is the evolution destination. diff -r 081070828703 -r 0884856a4143 README --- a/README Wed Sep 27 16:24:44 2017 +0200 +++ b/README Sat Sep 30 11:11:04 2017 +0100 @@ -121,6 +121,11 @@ Changelog ========= +6.7.1 - in progress +------------------- + + * stack: fix evolution previous for simple split + 6.7.0 -- 2017-09-27 ------------------- diff -r 081070828703 -r 0884856a4143 hgext3rd/topic/evolvebits.py --- a/hgext3rd/topic/evolvebits.py Wed Sep 27 16:24:44 2017 +0200 +++ b/hgext3rd/topic/evolvebits.py Sat Sep 30 11:11:04 2017 +0100 @@ -81,8 +81,16 @@ obs) obs = obs.parents()[0] newer = compat.successorssets(repo, obs.node()) - if len(newer) > 1 or len(newer[0]) > 1: + if 1 < len(newer): + # divergence case + # we should pick as arbitrary one raise MultipleSuccessorsError(newer) + elif 1 < len(newer[0]): + splitheads = list(repo.revs('heads(%ln::%ln)', newer[0], newer[0])) + if 1 < len(splitheads): + # split case, See if we can make sense of it. + raise MultipleSuccessorsError(newer) + return splitheads[0] return repo[newer[0][0]].rev() diff -r 081070828703 -r 0884856a4143 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Wed Sep 27 16:24:44 2017 +0200 +++ b/tests/test-topic-stack.t Sat Sep 30 11:11:04 2017 +0100 @@ -7,7 +7,7 @@ > [ui] > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n > [experimental] - > evolution=createmarkers,exchange,allowunstable + > evolution=all > EOF $ hg init main @@ -791,3 +791,125 @@ ^ c_F t1$ c_D (current unstable) t0^ c_C (base) + +Test stack behavior with a split +-------------------------------- + +get things linear again + + $ hg rebase -r t1 -d default + rebasing 16:1d84ec948370 "c_D" (tip) + switching to topic blue + $ hg rebase -r t2 -d t1 + rebasing 13:3ab2eedae500 "c_G" + $ hg rebase -r t3 -d t2 + rebasing 8:3bfe800e0486 "c_I" + $ hg stack + ### topic: blue + ### target: default (branch) + t3: c_I + t2: c_G + t1@ c_D (current) + t0^ c_A (base) + +making a split +(first get something to split) + + $ hg up t2 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status --change . + A ggg + $ echo zzz > Z + $ hg add Z + $ hg commit --amend + $ hg status --change . + A Z + A ggg + $ hg stack + ### topic: blue + ### target: default (branch) + t3$ c_I (unstable) + t2@ c_G (current) + t1: c_D + t0^ c_A (base) + $ hg --config extensions.evolve= --config ui.interactive=yes split << EOF + > y + > y + > n + > y + > EOF + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + adding Z + adding ggg + diff --git a/Z b/Z + new file mode 100644 + examine changes to 'Z'? [Ynesfdaq?] y + + @@ -0,0 +1,1 @@ + +zzz + record change 1/2 to 'Z'? [Ynesfdaq?] y + + diff --git a/ggg b/ggg + new file mode 100644 + examine changes to 'ggg'? [Ynesfdaq?] n + + Done splitting? [yN] y + + $ hg --config extensions.evolve= obslog --all + o dde94df880e9 (22) c_G + | + | @ e7ea874afbd5 (23) c_G + |/ + x b24bab30ac12 (21) c_G + | rewritten(parent, content) as dde94df880e9, e7ea874afbd5 by test (Thu Jan 01 00:00:00 1970 +0000) + | + x 907f7d3c2333 (18) c_G + | rewritten as b24bab30ac12 by test (Thu Jan 01 00:00:00 1970 +0000) + | + x 3ab2eedae500 (13) c_G + | rewritten as 907f7d3c2333 by test (Thu Jan 01 00:00:00 1970 +0000) + | + x c7d60a180d05 (6) c_G + rewritten as 3ab2eedae500 by test (Thu Jan 01 00:00:00 1970 +0000) + + $ hg export . + # HG changeset patch + # User test3 + # Date 0 0 + # Thu Jan 01 00:00:00 1970 +0000 + # Node ID e7ea874afbd5c17aeee366d39a828dbcb01682ce + # Parent dde94df880e97f4a1ee8c5408254b429b3d90204 + # EXP-Topic blue + c_G + + diff -r dde94df880e9 -r e7ea874afbd5 ggg + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/ggg Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +ggg + $ hg export .^ + # HG changeset patch + # User test3 + # Date 0 0 + # Thu Jan 01 00:00:00 1970 +0000 + # Node ID dde94df880e97f4a1ee8c5408254b429b3d90204 + # Parent f3328cd199dc389b850ca952f65a15a8e6dbc79b + # EXP-Topic blue + c_G + + diff -r f3328cd199dc -r dde94df880e9 Z + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/Z Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +zzz + +Check that stack ouput still make sense + + $ hg stack + ### topic: blue + ### target: default (branch) + t4$ c_I (unstable) + t3@ c_G (current) + t2: c_G + t1: c_D + t0^ c_A (base)