author | Steve Borho <steve@borho.org> |
Fri, 17 Sep 2010 12:44:35 -0500 | |
branch | stable |
changeset 12317 | ed639917c825 |
parent 11208 | 2313dc4d9817 |
permissions | -rwxr-xr-x |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
2 |
|
11208
2313dc4d9817
tests: fix bashism to load helpers.sh
Yuya Nishihara <yuya@tcha.org>
parents:
11198
diff
changeset
|
3 |
. $TESTDIR/helpers.sh |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
4 |
|
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
5 |
echo "[extensions]" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
6 |
echo "graphlog=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
7 |
echo "rebase=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
8 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
9 |
BASE=`pwd` |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
10 |
|
6910 | 11 |
addcommit () { |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
12 |
echo $1 > $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
13 |
hg add $1 |
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6910
diff
changeset
|
14 |
hg commit -d "${2} 0" -m $1 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
15 |
} |
6910 | 16 |
|
17 |
commit () { |
|
8168
8766fee6f225
tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
6910
diff
changeset
|
18 |
hg commit -d "${2} 0" -m $1 |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
19 |
} |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
20 |
|
6910 | 21 |
createrepo () { |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
22 |
cd $BASE |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
23 |
rm -rf a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
24 |
hg init a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
25 |
cd a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
26 |
addcommit "A" 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
27 |
addcommit "B" 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
28 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
29 |
hg update -C 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
30 |
addcommit "C" 2 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
31 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
32 |
hg update -C 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
33 |
addcommit "D" 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
34 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
35 |
hg merge -r 2 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
36 |
commit "E" 4 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
37 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
38 |
hg update -C 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
39 |
addcommit "F" 5 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
40 |
} |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
41 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
42 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
43 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
44 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
45 |
echo '% Rebasing' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
46 |
echo '% B onto F - simple rebase' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
47 |
hg rebase -s 1 -d 5 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
48 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
49 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
50 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
51 |
echo '% B onto D - intermediate point' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
52 |
hg rebase -s 1 -d 3 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
53 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
54 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
55 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
56 |
echo '% C onto F - skip of E' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
57 |
hg rebase -s 2 -d 5 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
58 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
59 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
60 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
61 |
echo '% D onto C - rebase of a branching point (skip E)' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
62 |
hg rebase -s 3 -d 2 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
63 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
64 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
65 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
66 |
echo '% E onto F - merged revision having a parent in ancestors of target' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
67 |
hg rebase -s 4 -d 5 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
68 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
69 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
70 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
71 |
echo '% D onto B - E maintains C as parent' |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
9578
diff
changeset
|
72 |
hg rebase -s 3 -d 1 | hidebackup |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
73 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
74 |
|
9578
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
75 |
echo '% These will fail (using --source)' |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
76 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
77 |
echo '% E onto D - rebase onto an ancestor' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
78 |
hg rebase -s 4 -d 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
79 |
echo '% D onto E - rebase onto a descendant' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
80 |
hg rebase -s 3 -d 4 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
81 |
echo '% E onto B - merge revision with both parents not in ancestors of target' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
82 |
hg rebase -s 4 -d 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
83 |
|
9578
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
84 |
echo |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
85 |
echo '% These will abort gracefully (using --base)' |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
86 |
echo '% E onto E - rebase onto same changeset' |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
87 |
hg rebase -b 4 -d 4 |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
88 |
echo '% E onto D - rebase onto an ancestor' |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
89 |
hg rebase -b 4 -d 3 |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
90 |
echo '% D onto E - rebase onto a descendant' |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
91 |
hg rebase -b 3 -d 4 |
341182ac95e4
rebase: return early when source is descendant of destination
Sune Foldager <cryo@cyanite.org>
parents:
8168
diff
changeset
|
92 |
|
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
93 |
exit 0 |