Mercurial > evolve
diff tests/test-split.t @ 4345:f45b4c31d81f
evolve: add test which shows fixed behaviour of `hg evolve` (issue5686)
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Fri, 18 Jan 2019 13:54:30 +0530 |
parents | 702f7e1d0b01 |
children | a71f2271ed76 c09889f81947 2a593d8f07e7 |
line wrap: on
line diff
--- 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 <<EOF + > [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 <<EOF + > 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) +