# HG changeset patch # User Sushil khanchi # Date 1547799870 -19800 # Node ID f45b4c31d81f63f3641b56d0f62e45c2ec347149 # Parent e5282131a78d3d71d03629a42ba20b9b92d15279 evolve: add test which shows fixed behaviour of `hg evolve` (issue5686) diff -r e5282131a78d -r f45b4c31d81f CHANGELOG --- a/CHANGELOG Tue Dec 25 14:35:54 2018 +0530 +++ b/CHANGELOG Fri Jan 18 13:54:30 2019 +0530 @@ -10,6 +10,7 @@ * split: accept file patterns * split: support for non interactive splits * evolve: avoid potential crash when stabilizing orphan merges + * evolve: pick right destination in split+prune cases issue5686 (4.9 only) * fold: concatenate commit message in revision order * push: have `--publish` overrule the `auto-publish` config * next: evolve aspiring children by default (use --no-evolve to skip) diff -r e5282131a78d -r f45b4c31d81f tests/test-split.t --- a/tests/test-split.t Tue Dec 25 14:35:54 2018 +0530 +++ b/tests/test-split.t Fri Jan 18 13:54:30 2019 +0530 @@ -4,6 +4,8 @@ $ . $TESTDIR/testlib/common.sh $ cat >> $HGRCPATH < [alias] + > glog = log -G -T "{rev}:{node|short} {desc|firstline} ({phase})\n" > [defaults] > amend=-d "0 0" > fold=-d "0 0" @@ -973,3 +975,144 @@ A SPLIT2 A SPLIT3 A SPLIT4 + + $ cd .. + +Testing that `hg evolve` choose right destination after split && prune (issue5686) +-------------------------------------------------------------------------------- + +Prepare the repository: + $ hg init issue5686 + $ cd issue5686 + $ echo p > p + $ hg ci -Amp + adding p + + $ for ch in a b; do echo $ch > $ch; done; + $ hg ci -Am "added a and b" + adding a + adding b + $ echo c > c + $ hg ci -Amc + adding c + $ hg glog + @ 2:ab6ca3ebca74 c (draft) + | + o 1:79f47e067e66 added a and b (draft) + | + o 0:a5a1faba8d26 p (draft) + + +To create commits with the number of split + $ echo 0 > num + $ cat > editor.sh << '__EOF__' + > NUM=$(cat num) + > NUM=`expr "$NUM" + 1` + > echo "$NUM" > num + > echo "split$NUM" > "$1" + > __EOF__ + $ export HGEDITOR="\"sh\" \"editor.sh\"" + +Splitting the revision 1 to SPLIT1 and SPLIT2 which contains file a and b resp: + $ hg split -r 1 < y + > y + > n + > y + > y + > y + > EOF + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + adding a + adding b + diff --git a/a b/a + new file mode 100644 + examine changes to 'a'? [Ynesfdaq?] y + + @@ -0,0 +1,1 @@ + +a + record change 1/2 to 'a'? [Ynesfdaq?] y + + diff --git a/b b/b + new file mode 100644 + examine changes to 'b'? [Ynesfdaq?] n + + created new head + (consider using topic for lightweight branches. See 'hg help topic') + continue splitting? [Ycdq?] y + diff --git a/b b/b + new file mode 100644 + examine changes to 'b'? [Ynesfdaq?] y + + @@ -0,0 +1,1 @@ + +b + record this change to 'b'? [Ynesfdaq?] y + + no more change to split + 1 new orphan changesets + + $ hg glog -p + @ 4:5cf253fa63fa split2 (draft) + | diff --git a/b b/b + | new file mode 100644 + | --- /dev/null + | +++ b/b + | @@ -0,0 +1,1 @@ + | +b + | + o 3:88437e073cd4 split1 (draft) + | diff --git a/a b/a + | new file mode 100644 + | --- /dev/null + | +++ b/a + | @@ -0,0 +1,1 @@ + | +a + | + | * 2:ab6ca3ebca74 c (draft) + | | diff --git a/c b/c + | | new file mode 100644 + | | --- /dev/null + | | +++ b/c + | | @@ -0,0 +1,1 @@ + | | +c + | | + | x 1:79f47e067e66 added a and b (draft) + |/ diff --git a/a b/a + | new file mode 100644 + | --- /dev/null + | +++ b/a + | @@ -0,0 +1,1 @@ + | +a + | diff --git a/b b/b + | new file mode 100644 + | --- /dev/null + | +++ b/b + | @@ -0,0 +1,1 @@ + | +b + | + o 0:a5a1faba8d26 p (draft) + diff --git a/p b/p + new file mode 100644 + --- /dev/null + +++ b/p + @@ -0,0 +1,1 @@ + +p + +Now if we prune revision 4 the expected destination of orphan cset 2 is 3. Lets +check evolve does as expected: +Pruning revision 4 (current one): + $ hg prune . + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + working directory now at 88437e073cd4 + 1 changesets pruned + $ hg evolve -r 2 + move:[2] c + atop:[3] split1 + working directory is now at 21a63bd6ee88 + $ hg glog + @ 5:21a63bd6ee88 c (draft) + | + o 3:88437e073cd4 split1 (draft) + | + o 0:a5a1faba8d26 p (draft) +