comparison tests/test-rebase-detach @ 10352:66d954e76ffb

rebase: add --detach option to detach intermediate revisions (issue1950) When rebasing an intermediate revision, rebase keeps a parent relationship with the original parent. This option forces the removal of this relationship. In more depth, it 'fakes' null merges between the target revision and the ancestors of source, dropping every change from the ancestors. The result is that every change in source and its descendants will be rebased, ignoring the changes in its ancestors.
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Sat, 06 Feb 2010 10:51:50 +0100
parents
children b345b1cc124f
comparison
equal deleted inserted replaced
10351:38fe86fb16e3 10352:66d954e76ffb
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "graphlog=" >> $HGRCPATH
5 echo "rebase=" >> $HGRCPATH
6
7 BASE=`pwd`
8
9 addcommit () {
10 echo $1 > $1
11 hg add $1
12 hg commit -d "${2} 0" -m $1
13 }
14
15 commit () {
16 hg commit -d "${2} 0" -m $1
17 }
18
19 createrepo () {
20 cd $BASE
21 rm -rf a
22 hg init a
23 cd a
24 addcommit "A" 0
25 addcommit "B" 1
26 addcommit "C" 2
27 addcommit "D" 3
28
29 hg update -C 0
30 addcommit "E" 4
31 }
32
33 createrepo > /dev/null 2>&1
34 hg glog --template '{rev}: {desc}\n'
35 echo '% Rebasing D onto E detaching from C'
36 hg rebase --detach -s 3 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
37 hg glog --template '{rev}: {desc}\n'
38 echo "Expected A, D, E"
39 hg manifest
40
41 echo
42 createrepo > /dev/null 2>&1
43 hg glog --template '{rev}: {desc}\n'
44 echo '% Rebasing C onto E detaching from B'
45 hg rebase --detach -s 2 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
46 hg glog --template '{rev}: {desc}\n'
47 echo "Expected A, C, D, E"
48 hg manifest
49
50 echo
51 createrepo > /dev/null 2>&1
52 hg glog --template '{rev}: {desc}\n'
53 echo '% Rebasing B onto E using detach (same as not using it)'
54 hg rebase --detach -s 1 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
55 hg glog --template '{rev}: {desc}\n'
56 echo "Expected A, B, C, D, E"
57 hg manifest
58
59 echo
60 createrepo > /dev/null 2>&1
61 hg glog --template '{rev}: {desc}\n'
62 echo '% Rebasing C onto E detaching from B and collapsing'
63 hg rebase --detach --collapse -s 2 -d 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
64 hg glog --template '{rev}: {desc}\n'
65 echo "Expected A, C, D, E"
66 hg manifest
67
68 exit 0