author | David Soria Parra <dsp@php.net> |
Sun, 07 Dec 2008 08:47:02 +0100 | |
changeset 7485 | ecfb683675ed |
parent 6910 | 93609576244e |
child 8168 | 8766fee6f225 |
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 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
3 |
echo "[extensions]" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
4 |
echo "graphlog=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
5 |
echo "rebase=" >> $HGRCPATH |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
6 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
7 |
BASE=`pwd` |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
8 |
|
6910 | 9 |
addcommit () { |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
10 |
echo $1 > $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
11 |
hg add $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
12 |
hg commit -d "${2} 0" -u test -m $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
13 |
} |
6910 | 14 |
|
15 |
commit () { |
|
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
16 |
hg commit -d "${2} 0" -u test -m $1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
17 |
} |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
18 |
|
6910 | 19 |
createrepo () { |
6906
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
20 |
cd $BASE |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
21 |
rm -rf a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
22 |
hg init a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
23 |
cd a |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
24 |
addcommit "A" 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
25 |
addcommit "B" 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
26 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
27 |
hg update -C 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
28 |
addcommit "C" 2 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
29 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
30 |
hg update -C 0 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
31 |
addcommit "D" 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
32 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
33 |
hg merge -r 2 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
34 |
commit "E" 4 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
35 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
36 |
hg update -C 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
37 |
addcommit "F" 5 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
38 |
} |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
39 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
40 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
41 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
42 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
43 |
echo '% Rebasing' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
44 |
echo '% B onto F - simple rebase' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
45 |
hg rebase -s 1 -d 5 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
46 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
47 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
48 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
49 |
echo '% B onto D - intermediate point' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
50 |
hg rebase -s 1 -d 3 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
51 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
52 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
53 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
54 |
echo '% C onto F - skip of E' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
55 |
hg rebase -s 2 -d 5 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
56 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
57 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
58 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
59 |
echo '% D onto C - rebase of a branching point (skip E)' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
60 |
hg rebase -s 3 -d 2 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
61 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
62 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
63 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
64 |
echo '% E onto F - merged revision having a parent in ancestors of target' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
65 |
hg rebase -s 4 -d 5 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
66 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
67 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
68 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
69 |
echo '% D onto B - E maintains C as parent' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
70 |
hg rebase -s 3 -d 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
71 |
hg glog --template '{rev}: {desc}\n' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
72 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
73 |
echo '% These will fail' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
74 |
createrepo > /dev/null 2>&1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
75 |
echo '% E onto D - rebase onto an ancestor' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
76 |
hg rebase -s 4 -d 3 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
77 |
echo '% D onto E - rebase onto a descendant' |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
78 |
hg rebase -s 3 -d 4 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
79 |
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
|
80 |
hg rebase -s 4 -d 1 |
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
81 |
|
808f03f61ebe
Add rebase extension
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff
changeset
|
82 |
exit 0 |