sapling/tests/test-fbamend-userestack.t
Arun Kulshreshtha 50c7f6c256 fbamend: add automatic restacking to split and fold
Summary: Automatically rebase unstable commits left behind after a split or fold in the middle of a stack. Previously, users had to run `hg restack` to fix their stacks after the fact. This change also fixes the issue identified in t14560234 whereby the old stack (entirely obsolete) stack would be left visible after splitting or folding a head commit due to the inhibit extension not correctly deinhibiting the old stack.

Test Plan: Create a stack of commits and perform `hg split` or `hg fold` on a commit (or set of commits) that have descendants. After the operation these commits should be rebased, preserving the linearity of the stack. See unit tests for specific test cases.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4432833

Tasks: 14560234, 15266009

Signature: t1:4432833:1484880689:1e07e421c8871dfef8bd016454aaed5a88a4a7d1
2017-01-20 00:24:45 -08:00

87 lines
1.7 KiB
Perl

Set up test environment.
$ . $TESTDIR/require-ext.sh directaccess evolve inhibit
$ extpath=`dirname $TESTDIR`
$ cp $extpath/hgext3rd/fbamend.py $TESTTMP # use $TESTTMP substitution in message
$ cat >> $HGRCPATH << EOF
> [extensions]
> directaccess=
> evolve=
> fbamend=$TESTTMP/fbamend.py
> inhibit=
> rebase=
> strip=
> [experimental]
> evolution = createmarkers
> evolutioncommands = prev next split fold
> [fbamend]
> userestack=true
> EOF
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> echo "add $1" > msg
> hg ci -l msg
> }
$ reset() {
> cd ..
> rm -rf userestack
> hg init userestack
> cd userestack
> }
$ showgraph() {
> hg log --graph -T "{rev} {desc|firstline}"
> }
$ hg init userestack && cd userestack
Test that no preamend bookmark is created.
$ mkcommit a
$ mkcommit b
$ mkcommit c
$ mkcommit d
$ hg up 1
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ hg amend -m "amended"
warning: the changeset's children were left behind
(use 'hg rebase --restack' (alias: 'hg restack') to rebase them)
$ hg book
no bookmarks set
Test hg amend --fixup.
$ showgraph
@ 4 amended
|
| o 3 add d
| |
| o 2 add c
| |
| o 1 add b
|/
o 0 add a
$ hg amend --fixup
rebasing 2:4538525df7e2 "add c"
rebasing 3:47d2a3944de8 "add d"
$ showgraph
o 6 add d
|
o 5 add c
|
@ 4 amended
|
o 0 add a
Test hg amend --rebase
$ hg amend -m "amended again" --rebase
rebasing 5:89333fbce6cd "add c"
rebasing 6:33b3e8631c12 "add d"
$ showgraph
o 9 add d
|
o 8 add c
|
@ 7 amended again
|
o 0 add a