##// END OF EJS Templates
tests: unify test-rebase*
Adrian Buehlmann -
r12608:16b854cb default
parent child Browse files
Show More
@@ -1,76 +1,148 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
4
9
5 echo "[extensions]" >> $HGRCPATH
10
6 echo "graphlog=" >> $HGRCPATH
11 $ hg init a
7 echo "rebase=" >> $HGRCPATH
12 $ cd a
13
14 $ echo c1 > common
15 $ hg add common
16 $ hg ci -m C1
8
17
9 createrepo() {
18 $ echo c2 >> common
10 rm -rf repo
19 $ hg ci -m C2
11 hg init repo
20
12 cd repo
21 $ echo c3 >> common
13 echo 'c1' >common
22 $ hg ci -m C3
14 hg add common
23
15 hg commit -d '0 0' -m "C1"
24 $ hg up -q -C 1
25
26 $ echo l1 >> extra
27 $ hg add extra
28 $ hg ci -m L1
29 created new head
30
31 $ sed -e 's/c2/l2/' common > common.new
32 $ mv common.new common
33 $ hg ci -m L2
16
34
17 echo 'c2' >>common
35 $ hg tglog
18 hg commit -d '1 0' -m "C2"
36 @ 4: 'L2'
37 |
38 o 3: 'L1'
39 |
40 | o 2: 'C3'
41 |/
42 o 1: 'C2'
43 |
44 o 0: 'C1'
45
19
46
20 echo 'c3' >>common
47 Conflicting rebase:
21 hg commit -d '2 0' -m "C3"
22
48
23 hg update -C 1
49 $ hg rebase -s 3 -d 2
24 echo 'l1' >>extra
50 merging common
25 hg add extra
51 warning: conflicts during merge.
26 hg commit -d '3 0' -m "L1"
52 merging common failed!
53 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
54 [255]
55
56 Abort:
57
58 $ hg rebase --abort
59 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
60 rebase aborted
27
61
28 sed -e 's/c2/l2/' common > common.new
62 $ hg tglog
29 mv common.new common
63 @ 4: 'L2'
30 hg commit -d '4 0' -m "L2"
64 |
31 }
65 o 3: 'L1'
32
66 |
33 echo
67 | o 2: 'C3'
34 createrepo > /dev/null 2>&1
68 |/
35 hg --config extensions.hgext.graphlog= glog --template '{rev}: {desc}\n'
69 o 1: 'C2'
70 |
71 o 0: 'C1'
72
73 $ cd ..
36
74
37 echo
75
38 echo '% Conflicting rebase'
76 Constrcut new repo:
39 hg --config extensions.hgext.rebase= rebase -s 3 -d 2 | cleanrebase
77
78 $ hg init b
79 $ cd b
80
81 $ echo a > a
82 $ hg ci -Am A
83 adding a
84
85 $ echo b > b
86 $ hg ci -Am B
87 adding b
40
88
41 echo
89 $ echo c > c
42 echo '% Abort'
90 $ hg ci -Am C
43 hg --config extensions.hgext.rebase= rebase --abort | cleanrebase
91 adding c
92
93 $ hg up -q 0
44
94
45 hg --config extensions.hgext.graphlog= glog --template '{rev}: {desc}\n'
95 $ echo b > b
96 $ hg ci -Am 'B bis'
97 adding b
98 created new head
99
100 $ echo c1 > c
101 $ hg ci -Am C1
102 adding c
103
104 Rebase and abort without generating new changesets:
46
105
47 createrepo() {
106 $ hg tglog
48 rm -rf repo
107 @ 4: 'C1'
49 hg init repo
108 |
50 cd repo
109 o 3: 'B bis'
51 echo "a">a
110 |
52 hg ci -A -m'A'
111 | o 2: 'C'
53 echo "b">b
112 | |
54 hg ci -A -m'B'
113 | o 1: 'B'
55 echo "c">c
114 |/
56 hg ci -A -m'C'
115 o 0: 'A'
57 hg up 0
116
58 echo "b">b
117 $ hg rebase -b 4 -d 2
59 hg ci -A -m'B bis'
118 merging c
60 echo "c1">c
119 warning: conflicts during merge.
61 hg ci -A -m'C1'
120 merging c failed!
62 }
121 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
63 echo
122 [255]
64 echo '% Rebase and abort without generating new changesets'
65
123
66 echo
124 $ hg tglog
67 createrepo > /dev/null 2>&1
125 @ 4: 'C1'
68 hg --config extensions.hgext.graphlog= glog --template '{rev}:{desc|short}\n'
126 |
69
127 o 3: 'B bis'
70 hg --config extensions.hgext.rebase= rebase -b 4 -d 2 | cleanrebase
128 |
129 | @ 2: 'C'
130 | |
131 | o 1: 'B'
132 |/
133 o 0: 'A'
134
135 $ hg rebase -a
136 rebase aborted
71
137
72 hg --config extensions.hgext.graphlog= glog --template '{rev}:{desc|short}\n'
138 $ hg tglog
73
139 @ 4: 'C1'
74 hg rebase -a | cleanrebase
140 |
75 hg glog --template '{rev}:{desc|short}\n'
141 o 3: 'B bis'
76
142 |
143 | o 2: 'C'
144 | |
145 | o 1: 'B'
146 |/
147 o 0: 'A'
148
@@ -1,106 +1,257 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > theads = heads --template "{rev}: '{desc}' {branches}\n"
9 > EOF
2
10
3 . $TESTDIR/helpers.sh
11 $ hg init a
12 $ cd a
4
13
5 createrepo() {
14 $ echo a > a
6 rm -rf repo
15 $ hg ci -Am A
7 hg init repo
16 adding a
8 cd repo
9
17
10 echo "a" > a
18 $ hg branch branch1
11 hg commit -d '0 0' -A -m 'A'
19 marked working directory as branch branch1
20 $ hg ci -m 'branch1'
21
22 $ echo b > b
23 $ hg ci -Am B
24 adding b
25
26 $ hg up -q 0
12
27
13 hg branch branch1
28 $ hg branch branch2
14 hg commit -d '1 0' -m 'Branch1'
29 marked working directory as branch branch2
30 $ hg ci -m 'branch2'
15
31
16 echo "b" > b
32 $ echo c > C
17 hg commit -A -d '2 0' -m 'B'
33 $ hg ci -Am C
34 adding C
35
36 $ hg up -q 2
18
37
19 hg up 0
38 $ hg branch -f branch2
20 hg branch branch2
39 marked working directory as branch branch2
21 hg commit -d '3 0' -m 'Branch2'
40 $ echo d > d
41 $ hg ci -Am D
42 adding d
43 created new head
22
44
23 echo "c" > C
45 $ echo e > e
24 hg commit -A -d '4 0' -m 'C'
46 $ hg ci -Am E
47 adding e
48
49 $ hg update default
50 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
51
52 $ hg branch branch3
53 marked working directory as branch branch3
54 $ hg ci -m 'branch3'
25
55
26 hg up 2
56 $ echo f > f
27 hg branch -f branch2
57 $ hg ci -Am F
28 echo "d" > d
58 adding f
29 hg commit -A -d '5 0' -m 'D'
59
60 $ cd ..
30
61
31 echo "e" > e
62
32 hg commit -A -d '6 0' -m 'E'
63 Rebase part of branch2 (5-6) onto branch3 (8):
33
64
34 hg update default
65 $ hg clone -q -u . a a1
66 $ cd a1
35
67
36 hg branch branch3
68 $ hg tglog
37 hg commit -d '7 0' -m 'Branch3'
69 @ 8: 'F' branch3
38
70 |
39 echo "f" > f
71 o 7: 'branch3' branch3
40 hg commit -A -d '8 0' -m 'F'
72 |
41 }
73 | o 6: 'E' branch2
74 | |
75 | o 5: 'D' branch2
76 | |
77 | | o 4: 'C' branch2
78 | | |
79 +---o 3: 'branch2' branch2
80 | |
81 | o 2: 'B' branch1
82 | |
83 | o 1: 'branch1' branch1
84 |/
85 o 0: 'A'
86
87 $ hg branches
88 branch3 8:05b64c4ca2d8
89 branch2 6:b410fbec727a
90 branch1 2:9d931918fcf7 (inactive)
91 default 0:1994f17a630e (inactive)
42
92
43 echo
93 $ hg theads
44 createrepo > /dev/null 2>&1
94 8: 'F' branch3
45 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
95 6: 'E' branch2
96 4: 'C' branch2
97 2: 'B' branch1
98 0: 'A'
99
100 $ hg rebase --detach -s 5 -d 8
101 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
46
102
47 echo
103 $ hg branches
48 echo '% Branches'
104 branch3 8:c1d4b9719987
49 hg branches
105 branch2 4:1be2b203ae5e
106 branch1 2:9d931918fcf7
107 default 0:1994f17a630e (inactive)
108
109 $ hg theads
110 8: 'E' branch3
111 4: 'C' branch2
112 2: 'B' branch1
113 0: 'A'
50
114
51 echo
115 $ hg tglog
52 echo '% Heads'
116 @ 8: 'E' branch3
53 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
117 |
118 o 7: 'D' branch3
119 |
120 o 6: 'F' branch3
121 |
122 o 5: 'branch3' branch3
123 |
124 | o 4: 'C' branch2
125 | |
126 | o 3: 'branch2' branch2
127 |/
128 | o 2: 'B' branch1
129 | |
130 | o 1: 'branch1' branch1
131 |/
132 o 0: 'A'
133
134 $ cd ..
54
135
55 echo
136
56 echo '% Rebase part of branch2 (5-6) onto branch3 (8)'
137 Rebase head of branch3 (8) onto branch2 (6):
57 hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup
58
138
59 echo
139 $ hg clone -q -u . a a2
60 echo '% Branches'
140 $ cd a2
61 hg branches
62
141
63 echo
142 $ hg tglog
64 echo '% Heads'
143 @ 8: 'F' branch3
65 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
144 |
66
145 o 7: 'branch3' branch3
67 echo
146 |
68 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
147 | o 6: 'E' branch2
148 | |
149 | o 5: 'D' branch2
150 | |
151 | | o 4: 'C' branch2
152 | | |
153 +---o 3: 'branch2' branch2
154 | |
155 | o 2: 'B' branch1
156 | |
157 | o 1: 'branch1' branch1
158 |/
159 o 0: 'A'
160
161 $ hg rebase --detach -s 8 -d 6
162 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
69
163
70 echo
164 $ hg branches
71 echo '% Rebase head of branch3 (8) onto branch2 (6)'
165 branch2 8:e1e80ed73210
72 createrepo > /dev/null 2>&1
166 branch3 7:75fd7b643dce
73 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
167 branch1 2:9d931918fcf7 (inactive)
168 default 0:1994f17a630e (inactive)
74
169
75 hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup
170 $ hg theads
171 8: 'F' branch2
172 7: 'branch3' branch3
173 4: 'C' branch2
174 2: 'B' branch1
175 0: 'A'
76
176
77 echo
177 $ hg tglog
78 echo '% Branches'
178 @ 8: 'F' branch2
79 hg branches
179 |
180 | o 7: 'branch3' branch3
181 | |
182 o | 6: 'E' branch2
183 | |
184 o | 5: 'D' branch2
185 | |
186 | | o 4: 'C' branch2
187 | | |
188 | | o 3: 'branch2' branch2
189 | |/
190 o | 2: 'B' branch1
191 | |
192 o | 1: 'branch1' branch1
193 |/
194 o 0: 'A'
195
196 $ hg verify -q
80
197
81 echo
198 $ cd ..
82 echo '% Heads'
199
83 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
84
200
85 echo
201 Rebase entire branch3 (7-8) onto branch2 (6):
86 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
202
87 hg verify -q
203 $ hg clone -q -u . a a3
204 $ cd a3
88
205
89 echo
206 $ hg tglog
90 echo '% Rebase entire branch3 (7-8) onto branch2 (6)'
207 @ 8: 'F' branch3
91 createrepo > /dev/null 2>&1
208 |
92 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
209 o 7: 'branch3' branch3
93
210 |
94 hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 | hidebackup
211 | o 6: 'E' branch2
212 | |
213 | o 5: 'D' branch2
214 | |
215 | | o 4: 'C' branch2
216 | | |
217 +---o 3: 'branch2' branch2
218 | |
219 | o 2: 'B' branch1
220 | |
221 | o 1: 'branch1' branch1
222 |/
223 o 0: 'A'
224
225 $ hg rebase --detach -s 7 -d 6
226 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
95
227
96 echo
228 $ hg branches
97 echo '% Branches'
229 branch2 7:e1e80ed73210
98 hg branches
230 branch1 2:9d931918fcf7 (inactive)
231 default 0:1994f17a630e (inactive)
232
233 $ hg theads
234 7: 'F' branch2
235 4: 'C' branch2
236 2: 'B' branch1
237 0: 'A'
99
238
100 echo
239 $ hg tglog
101 echo '% Heads'
240 @ 7: 'F' branch2
102 hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'
241 |
242 o 6: 'E' branch2
243 |
244 o 5: 'D' branch2
245 |
246 | o 4: 'C' branch2
247 | |
248 | o 3: 'branch2' branch2
249 | |
250 o | 2: 'B' branch1
251 | |
252 o | 1: 'branch1' branch1
253 |/
254 o 0: 'A'
255
256 $ hg verify -q
103
257
104 echo
105 hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
106 hg verify -q
@@ -1,70 +1,142 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
4
9
5 echo "[extensions]" >> $HGRCPATH
10
6 echo "graphlog=" >> $HGRCPATH
11 $ hg init a
7 echo "rebase=" >> $HGRCPATH
12 $ cd a
13
14 $ echo A > A
15 $ hg add A
16 $ hg ci -m A
8
17
9 BASE=`pwd`
18 $ echo 'B' > B
19 $ hg add B
20 $ hg ci -m B
21
22 $ echo C >> A
23 $ hg ci -m C
10
24
11 addcommit () {
25 $ hg up -q -C 0
12 echo $1 > $1
26
13 hg add $1
27 $ echo D >> A
14 hg commit -d "${2} 0" -m $1
28 $ hg ci -m D
15 }
29 created new head
30
31 $ echo E > E
32 $ hg add E
33 $ hg ci -m E
16
34
17 commit () {
35 $ hg up -q -C 0
18 hg commit -d "${2} 0" -m $1
36
19 }
37 $ hg branch 'notdefault'
38 marked working directory as branch notdefault
39 $ echo F >> A
40 $ hg ci -m F
41
42 $ cd ..
43
44
45 Rebasing B onto E - check keep:
46
47 $ hg clone -q -u . a a1
48 $ cd a1
20
49
21 createrepo () {
50 $ hg tglog
22 cd $BASE
51 @ 5: 'F' notdefault
23 rm -rf a
52 |
24 hg init a
53 | o 4: 'E'
25 cd a
54 | |
26 addcommit "A" 0
55 | o 3: 'D'
27 addcommit "B" 1
56 |/
28 echo "C" >> A
57 | o 2: 'C'
29 commit "C" 2
58 | |
59 | o 1: 'B'
60 |/
61 o 0: 'A'
62
63 $ hg rebase -s 1 -d 4 --keep
64 merging A
65 warning: conflicts during merge.
66 merging A failed!
67 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
68 [255]
30
69
31 hg update -C 0
70 Solve the conflict and go on:
32 echo "D" >> A
33 commit "D" 3
34 addcommit "E" 4
35
71
36 hg update -C 0
72 $ echo 'conflict solved' > A
37 hg branch 'notdefault'
73 $ rm A.orig
38 echo "F" >> A
74 $ hg resolve -m A
39 commit "F" 5
75 $ hg rebase --continue
40 }
41
76
42 echo
77 $ hg tglog
43 echo "% - Rebasing B onto E - check keep"
78 @ 7: 'C'
44 createrepo > /dev/null 2>&1
79 |
45 hg glog --template '{rev}:{desc}:{branches}\n'
80 o 6: 'B'
46 hg rebase -s 1 -d 4 --keep | hidebackup
81 |
82 | o 5: 'F' notdefault
83 | |
84 o | 4: 'E'
85 | |
86 o | 3: 'D'
87 |/
88 | o 2: 'C'
89 | |
90 | o 1: 'B'
91 |/
92 o 0: 'A'
93
94 $ cd ..
95
96
97 Rebase F onto E - check keepbranches:
98
99 $ hg clone -q -u . a a2
100 $ cd a2
47
101
48 echo
102 $ hg tglog
49 echo "% - Solve the conflict and go on"
103 @ 5: 'F' notdefault
50 echo 'conflict solved' > A
104 |
51 rm A.orig
105 | o 4: 'E'
52 hg resolve -m A
106 | |
53 hg rebase --continue | hidebackup
107 | o 3: 'D'
54 hg glog --template '{rev}:{desc}:{branches}\n'
108 |/
109 | o 2: 'C'
110 | |
111 | o 1: 'B'
112 |/
113 o 0: 'A'
114
115 $ hg rebase -s 5 -d 4 --keepbranches
116 merging A
117 warning: conflicts during merge.
118 merging A failed!
119 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
120 [255]
55
121
56 echo
122 Solve the conflict and go on:
57 echo "% - Rebase F onto E - check keepbranches"
123
58 createrepo > /dev/null 2>&1
124 $ echo 'conflict solved' > A
59 hg glog --template '{rev}:{desc}:{branches}\n'
125 $ rm A.orig
60 hg rebase -s 5 -d 4 --keepbranches | hidebackup
126 $ hg resolve -m A
127 $ hg rebase --continue
128 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
61
129
62 echo
130 $ hg tglog
63 echo "% - Solve the conflict and go on"
131 @ 5: 'F' notdefault
64 echo 'conflict solved' > A
132 |
65 rm A.orig
133 o 4: 'E'
66 hg resolve -m A
134 |
67 hg rebase --continue 2>&1 | hidebackup
135 o 3: 'D'
68 hg glog --template '{rev}:{desc}:{branches}\n'
136 |
69
137 | o 2: 'C'
70 exit 0
138 | |
139 | o 1: 'B'
140 |/
141 o 0: 'A'
142
This diff has been collapsed as it changes many lines, (552 lines changed) Show them Hide them
@@ -1,177 +1,441 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
4
9
5 echo "[extensions]" >> $HGRCPATH
10 Create repo a:
6 echo "graphlog=" >> $HGRCPATH
7 echo "rebase=" >> $HGRCPATH
8
11
9 BASE=`pwd`
12 $ hg init a
13 $ cd a
10
14
11 addcommit () {
15 $ echo A > A
12 echo $1 > $1
16 $ hg ci -Am A
13 hg add $1
17 adding A
14 hg commit -d "${2} 0" -m $1
18 $ echo B > B
15 }
19 $ hg ci -Am B
20 adding B
21 $ echo C > C
22 $ hg ci -Am C
23 adding C
24 $ echo D > D
25 $ hg ci -Am D
26 adding D
27
28 $ hg up -q -C 0
16
29
17 commit () {
30 $ echo E > E
18 hg commit -d "${2} 0" -m $1
31 $ hg ci -Am E
19 }
32 adding E
33 created new head
34
35 $ hg up -q -C 0
36
37 $ echo F > F
38 $ hg ci -Am F
39 adding F
40 created new head
41
42 $ hg merge -r 4
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 (branch merge, don't forget to commit)
45 $ hg ci -m G
46
47 $ hg up -q -C 5
48
49 $ echo H > H
50 $ hg ci -Am H
51 adding H
52 created new head
20
53
21 createrepo () {
54 $ hg tglog
22 cd $BASE
55 @ 7: 'H'
23 rm -rf a
56 |
24 hg init a
57 | o 6: 'G'
25 cd a
58 |/|
26 addcommit "A" 0
59 o | 5: 'F'
27 addcommit "B" 1
60 | |
28 addcommit "C" 2
61 | o 4: 'E'
29 addcommit "D" 3
62 |/
63 | o 3: 'D'
64 | |
65 | o 2: 'C'
66 | |
67 | o 1: 'B'
68 |/
69 o 0: 'A'
70
71 $ cd ..
72
73
74 Rebasing B onto H:
75
76 $ hg clone -q -u 3 a a1
77 $ cd a1
78
79 $ hg rebase --collapse --keepbranches
80 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
30
81
31 hg update -C 0
82 $ hg tglog
32 addcommit "E" 4
83 @ 5: 'Collapsed revision
33
84 | * B
34 hg update -C 0
85 | * C
35 addcommit "F" 5
86 | * D'
87 o 4: 'H'
88 |
89 | o 3: 'G'
90 |/|
91 o | 2: 'F'
92 | |
93 | o 1: 'E'
94 |/
95 o 0: 'A'
96
97 $ hg manifest
98 A
99 B
100 C
101 D
102 F
103 H
36
104
37 hg merge -r 4
105 $ cd ..
38 commit "G" 6
39
106
40 hg update -C 5
107
41 addcommit "H" 7
108 Rebasing G onto H:
42 }
43
109
44 createrepo > /dev/null 2>&1
110 $ hg clone -q -u . a a2
45 hg glog --template '{rev}: {desc}\n'
111 $ cd a2
46 echo '% Rebasing B onto H'
112
47 hg up -C 3
113 $ hg rebase --base 6 --collapse
48 hg rebase --collapse --keepbranches | hidebackup
114 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
49 hg glog --template '{rev}: {desc}\n'
50 echo "Expected A, B, C, D, F, H"
51 hg manifest
52
115
53 createrepo > /dev/null 2>&1
116 $ hg tglog
54 echo
117 @ 6: 'Collapsed revision
55 echo '% Rebasing G onto H'
118 | * E
56 hg rebase --base 6 --collapse | hidebackup
119 | * G'
57 hg glog --template '{rev}: {desc}\n'
120 o 5: 'H'
58 echo "Expected A, E, F, H"
121 |
59 hg manifest
122 o 4: 'F'
123 |
124 | o 3: 'D'
125 | |
126 | o 2: 'C'
127 | |
128 | o 1: 'B'
129 |/
130 o 0: 'A'
131
132 $ hg manifest
133 A
134 E
135 F
136 H
137
138 $ cd ..
139
140
141 Create repo b:
142
143 $ hg init b
144 $ cd b
145
146 $ echo A > A
147 $ hg ci -Am A
148 adding A
149 $ echo B > B
150 $ hg ci -Am B
151 adding B
152
153 $ hg up -q 0
154
155 $ echo C > C
156 $ hg ci -Am C
157 adding C
158 created new head
159
160 $ hg merge
161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 (branch merge, don't forget to commit)
60
163
61 createrepocomplex () {
164 $ echo D > D
62 cd $BASE
165 $ hg ci -Am D
63 rm -rf a
166 adding D
64 hg init a
167
65 cd a
168 $ hg up -q 1
66 addcommit "A" 0
169
67 addcommit "B" 1
170 $ echo E > E
171 $ hg ci -Am E
172 adding E
173 created new head
68
174
69 hg up 0
175 $ echo F > F
70 addcommit "C" 2
176 $ hg ci -Am F
71 hg merge
177 adding F
72 commit "D" 3
178
179 $ hg merge
180 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 (branch merge, don't forget to commit)
182 $ hg ci -m G
183
184 $ hg up -q 0
185
186 $ echo H > H
187 $ hg ci -Am H
188 adding H
189 created new head
73
190
74 hg up 1
191 $ hg tglog
75 addcommit "E" 4
192 @ 7: 'H'
76
193 |
77 addcommit "F" 5
194 | o 6: 'G'
78
195 | |\
79 hg merge
196 | | o 5: 'F'
80 commit "G" 6
197 | | |
198 | | o 4: 'E'
199 | | |
200 | o | 3: 'D'
201 | |\|
202 | o | 2: 'C'
203 |/ /
204 | o 1: 'B'
205 |/
206 o 0: 'A'
207
208 $ cd ..
81
209
82 hg up 0
210
83 addcommit "H" 7
211 Rebase and collapse - more than one external (fail):
84 }
212
213 $ hg clone -q -u . b b1
214 $ cd b1
85
215
86 echo
216 $ hg rebase -s 2 --collapse
87 createrepocomplex > /dev/null 2>&1
217 abort: unable to collapse, there is more than one external parent
88 hg glog --template '{rev}: {desc}\n'
218 [255]
219
220 Rebase and collapse - E onto H:
89
221
90 echo
222 $ hg rebase -s 4 --collapse
91 echo '% Rebase and collapse - more than one external (fail)'
223 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
92 hg rebase -s 2 --collapse
93
224
94 echo
225 $ hg tglog
95 echo '% Rebase and collapse - E onto H'
226 @ 5: 'Collapsed revision
96 hg rebase -s 4 --collapse | hidebackup
227 |\ * E
97 hg glog --template '{rev}: {desc}\n'
228 | | * F
98 echo "Expected A, B, C, E, F, H"
229 | | * G'
99 hg manifest
230 | o 4: 'H'
231 | |
232 o | 3: 'D'
233 |\ \
234 | o | 2: 'C'
235 | |/
236 o / 1: 'B'
237 |/
238 o 0: 'A'
239
240 $ hg manifest
241 A
242 B
243 C
244 D
245 E
246 F
247 H
100
248
101 createrepocomplex () {
249 $ cd ..
102 cd $BASE
250
103 rm -rf a
251
104 hg init a
252 Create repo c:
105 cd a
253
106 addcommit "A" 0
254 $ hg init c
107 addcommit "B" 1
255 $ cd c
256
257 $ echo A > A
258 $ hg ci -Am A
259 adding A
260 $ echo B > B
261 $ hg ci -Am B
262 adding B
263
264 $ hg up -q 0
265
266 $ echo C > C
267 $ hg ci -Am C
268 adding C
269 created new head
270
271 $ hg merge
272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 (branch merge, don't forget to commit)
108
274
109 hg up 0
275 $ echo D > D
110 addcommit "C" 2
276 $ hg ci -Am D
111 hg merge
277 adding D
112 commit "D" 3
278
279 $ hg up -q 1
113
280
114 hg up 1
281 $ echo E > E
115 addcommit "E" 4
282 $ hg ci -Am E
116
283 adding E
117 echo "F" > E
284 created new head
118 commit "F" 5
285 $ echo F > E
286 $ hg ci -m 'F'
287
288 $ echo G > G
289 $ hg ci -Am G
290 adding G
291
292 $ hg merge
293 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 (branch merge, don't forget to commit)
295
296 $ hg ci -m H
297
298 $ hg up -q 0
119
299
120 addcommit "G" 6
300 $ echo I > I
121
301 $ hg ci -Am I
122 hg merge
302 adding I
123 commit "H" 7
303 created new head
124
304
125 hg up 0
305 $ hg tglog
126 addcommit "I" 8
306 @ 8: 'I'
127 }
307 |
308 | o 7: 'H'
309 | |\
310 | | o 6: 'G'
311 | | |
312 | | o 5: 'F'
313 | | |
314 | | o 4: 'E'
315 | | |
316 | o | 3: 'D'
317 | |\|
318 | o | 2: 'C'
319 |/ /
320 | o 1: 'B'
321 |/
322 o 0: 'A'
323
324 $ cd ..
128
325
129 echo
326
130 createrepocomplex > /dev/null 2>&1
327 Rebase and collapse - E onto I:
131 hg glog --template '{rev}: {desc}\n'
328
329 $ hg clone -q -u . c c1
330 $ cd c1
132
331
133 echo
332 $ hg rebase -s 4 --collapse
134 echo '% Rebase and collapse - E onto I'
333 merging E
135 hg rebase -s 4 --collapse | hidebackup
334 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
136
137 hg glog --template '{rev}: {desc}\n'
138
139 echo "Expected A, B, C, E, G, I"
140 hg manifest
141
335
142 echo 'Cat E:'
336 $ hg tglog
143 cat E
337 @ 5: 'Collapsed revision
338 |\ * E
339 | | * F
340 | | * G
341 | | * H'
342 | o 4: 'I'
343 | |
344 o | 3: 'D'
345 |\ \
346 | o | 2: 'C'
347 | |/
348 o / 1: 'B'
349 |/
350 o 0: 'A'
351
352 $ hg manifest
353 A
354 B
355 C
356 D
357 E
358 G
359 I
144
360
145 createrepocomplex () {
361 $ cat E
146 cd $BASE
362 F
147 rm -rf a
363
148 hg init a
364 $ cd ..
149 cd a
365
150 addcommit "A" 0
366
151 addcommit "B" 1
367 Create repo d:
368
369 $ hg init d
370 $ cd d
152
371
153 addcommit "C" 2
372 $ echo A > A
154 hg up 1
373 $ hg ci -Am A
374 adding A
375 $ echo B > B
376 $ hg ci -Am B
377 adding B
378 $ echo C > C
379 $ hg ci -Am C
380 adding C
381
382 $ hg up -q 1
155
383
156 addcommit "D" 3
384 $ echo D > D
157
385 $ hg ci -Am D
158 hg merge
386 adding D
159 commit "E" 4
387 created new head
388 $ hg merge
389 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 (branch merge, don't forget to commit)
160
391
161 hg up 0
392 $ hg ci -m E
162 addcommit "F" 5
393
163 }
394 $ hg up -q 0
395
396 $ echo F > F
397 $ hg ci -Am F
398 adding F
399 created new head
164
400
165 echo
401 $ hg tglog
166 createrepocomplex > /dev/null 2>&1
402 @ 5: 'F'
167 hg glog --template '{rev}: {desc}\n'
403 |
404 | o 4: 'E'
405 | |\
406 | | o 3: 'D'
407 | | |
408 | o | 2: 'C'
409 | |/
410 | o 1: 'B'
411 |/
412 o 0: 'A'
413
414 $ cd ..
415
416
417 Rebase and collapse - B onto F:
418
419 $ hg clone -q -u . d d1
420 $ cd d1
168
421
169 echo
422 $ hg rebase -s 1 --collapse
170 echo '% Rebase and collapse - B onto F'
423 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
171 hg rebase -s 1 --collapse | hidebackup
172
424
173 hg glog --template '{rev}: {desc}\n'
425 $ hg tglog
426 @ 2: 'Collapsed revision
427 | * B
428 | * C
429 | * D
430 | * E'
431 o 1: 'F'
432 |
433 o 0: 'A'
434
435 $ hg manifest
436 A
437 B
438 C
439 D
440 F
174
441
175 echo "Expected A, B, C, D, F"
176 hg manifest
177 exit 0
@@ -1,74 +1,115 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4
4 > rebase=
5 echo "[extensions]" >> $HGRCPATH
5 >
6 echo "graphlog=" >> $HGRCPATH
6 > [alias]
7 echo "rebase=" >> $HGRCPATH
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
8
9
9 hg init a
10 $ hg init a
10 cd a
11 $ cd a
11 echo 'c1' >common
12 $ echo c1 >common
12 hg add common
13 $ hg add common
13 hg commit -d '0 0' -m "C1"
14 $ hg ci -m C1
15
16 $ echo c2 >>common
17 $ hg ci -m C2
14
18
15 echo 'c2' >>common
19 $ echo c3 >>common
16 hg commit -d '1 0' -m "C2"
20 $ hg ci -m C3
21
22 $ hg up -q -C 1
23
24 $ echo l1 >>extra
25 $ hg add extra
26 $ hg ci -m L1
27 created new head
17
28
18 echo 'c3' >>common
29 $ sed -e 's/c2/l2/' common > common.new
19 hg commit -d '2 0' -m "C3"
30 $ mv common.new common
31 $ hg ci -m L2
20
32
21 hg update -C 1
33 $ echo l3 >> extra2
22 echo 'l1' >>extra
34 $ hg add extra2
23 hg add extra
35 $ hg ci -m L3
24 hg commit -d '3 0' -m "L1"
25
36
26 sed -e 's/c2/l2/' common > common.new
37 $ hg tglog
27 mv common.new common
38 @ 5: 'L3'
28 hg commit -d '4 0' -m "L2"
39 |
40 o 4: 'L2'
41 |
42 o 3: 'L1'
43 |
44 | o 2: 'C3'
45 |/
46 o 1: 'C2'
47 |
48 o 0: 'C1'
49
50 Try to call --continue:
29
51
30 echo 'l3' >> extra2
52 $ hg rebase --continue
31 hg add extra2
53 abort: no rebase in progress
32 hg commit -d '5 0' -m "L3"
54 [255]
33
55
34 hg glog --template '{rev}: {desc}\n'
56 Conflicting rebase:
35
57
36 echo
58 $ hg rebase -s 3 -d 2
37 echo '% Try to call --continue'
59 merging common
38 hg rebase --continue
60 warning: conflicts during merge.
61 merging common failed!
62 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
63 [255]
39
64
40 echo
65 Try to continue without solving the conflict:
41 echo '% Conflicting rebase'
42 hg rebase -s 3 -d 2
43
66
44 echo
67 $ hg rebase --continue
45 echo '% Try to continue without solving the conflict'
68 abort: unresolved merge conflicts (see hg resolve)
46 hg rebase --continue
69 [255]
47
70
48 echo
71 Conclude rebase:
49 echo '% Conclude rebase'
50 echo 'resolved merge' >common
51 hg resolve -m common
52 hg rebase --continue | cleanrebase
53
72
54 hg glog --template '{rev}: {desc}\n'
73 $ echo 'resolved merge' >common
74 $ hg resolve -m common
75 $ hg rebase --continue
76 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
55
77
56 echo
78 $ hg tglog
57 echo '% Check correctness'
79 @ 5: 'L3'
58 echo ' - Rev. 0'
80 |
59 hg cat -r 0 common
81 o 4: 'L2'
82 |
83 o 3: 'L1'
84 |
85 o 2: 'C3'
86 |
87 o 1: 'C2'
88 |
89 o 0: 'C1'
90
91 Check correctness:
60
92
61 echo ' - Rev. 1'
93 $ hg cat -r 0 common
62 hg cat -r 1 common
94 c1
63
95
64 echo ' - Rev. 2'
96 $ hg cat -r 1 common
65 hg cat -r 2 common
97 c1
98 c2
66
99
67 echo ' - Rev. 3'
100 $ hg cat -r 2 common
68 hg cat -r 3 common
101 c1
102 c2
103 c3
69
104
70 echo ' - Rev. 4'
105 $ hg cat -r 3 common
71 hg cat -r 4 common
106 c1
107 c2
108 c3
72
109
73 echo ' - Rev. 5'
110 $ hg cat -r 4 common
74 hg cat -r 5 common
111 resolved merge
112
113 $ hg cat -r 5 common
114 resolved merge
115
@@ -1,70 +1,193 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
2
9
3 . $TESTDIR/helpers.sh
4
10
5 echo "[extensions]" >> $HGRCPATH
11 $ hg init a
6 echo "graphlog=" >> $HGRCPATH
12 $ cd a
7 echo "rebase=" >> $HGRCPATH
13
14 $ echo A > A
15 $ hg ci -Am A
16 adding A
17
18 $ echo B > B
19 $ hg ci -Am B
20 adding B
8
21
9 BASE=`pwd`
22 $ echo C > C
23 $ hg ci -Am C
24 adding C
25
26 $ echo D > D
27 $ hg ci -Am D
28 adding D
29
30 $ hg up -q -C 0
10
31
11 addcommit () {
32 $ echo E > E
12 echo $1 > $1
33 $ hg ci -Am E
13 hg add $1
34 adding E
14 hg commit -d "${2} 0" -m $1
35 created new head
15 }
36
37 $ cd ..
38
39
40 Rebasing D onto E detaching from C:
41
42 $ hg clone -q -u . a a1
43 $ cd a1
16
44
17 commit () {
45 $ hg tglog
18 hg commit -d "${2} 0" -m $1
46 @ 4: 'E'
19 }
47 |
48 | o 3: 'D'
49 | |
50 | o 2: 'C'
51 | |
52 | o 1: 'B'
53 |/
54 o 0: 'A'
55
56 $ hg rebase --detach -s 3 -d 4
57 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
20
58
21 createrepo () {
59 $ hg tglog
22 cd $BASE
60 @ 4: 'D'
23 rm -rf a
61 |
24 hg init a
62 o 3: 'E'
25 cd a
63 |
26 addcommit "A" 0
64 | o 2: 'C'
27 addcommit "B" 1
65 | |
28 addcommit "C" 2
66 | o 1: 'B'
29 addcommit "D" 3
67 |/
68 o 0: 'A'
69
70 $ hg manifest
71 A
72 D
73 E
74
75 $ cd ..
76
30
77
31 hg update -C 0
78 Rebasing C onto E detaching from B:
32 addcommit "E" 4
79
33 }
80 $ hg clone -q -u . a a2
81 $ cd a2
82
83 $ hg tglog
84 @ 4: 'E'
85 |
86 | o 3: 'D'
87 | |
88 | o 2: 'C'
89 | |
90 | o 1: 'B'
91 |/
92 o 0: 'A'
93
94 $ hg rebase --detach -s 2 -d 4
95 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
34
96
35 createrepo > /dev/null 2>&1
97 $ hg tglog
36 hg glog --template '{rev}: {desc}\n'
98 @ 4: 'D'
37 echo '% Rebasing D onto E detaching from C'
99 |
38 hg rebase --detach -s 3 -d 4 | hidebackup
100 o 3: 'C'
39 hg glog --template '{rev}: {desc}\n'
101 |
40 echo "Expected A, D, E"
102 o 2: 'E'
41 hg manifest
103 |
104 | o 1: 'B'
105 |/
106 o 0: 'A'
107
108 $ hg manifest
109 A
110 C
111 D
112 E
113
114 $ cd ..
42
115
43 echo
116
44 createrepo > /dev/null 2>&1
117 Rebasing B onto E using detach (same as not using it):
45 hg glog --template '{rev}: {desc}\n'
118
46 echo '% Rebasing C onto E detaching from B'
119 $ hg clone -q -u . a a3
47 hg rebase --detach -s 2 -d 4 | hidebackup
120 $ cd a3
48 hg glog --template '{rev}: {desc}\n'
121
49 echo "Expected A, C, D, E"
122 $ hg tglog
50 hg manifest
123 @ 4: 'E'
124 |
125 | o 3: 'D'
126 | |
127 | o 2: 'C'
128 | |
129 | o 1: 'B'
130 |/
131 o 0: 'A'
132
133 $ hg rebase --detach -s 1 -d 4
134 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
51
135
52 echo
136 $ hg tglog
53 createrepo > /dev/null 2>&1
137 @ 4: 'D'
54 hg glog --template '{rev}: {desc}\n'
138 |
55 echo '% Rebasing B onto E using detach (same as not using it)'
139 o 3: 'C'
56 hg rebase --detach -s 1 -d 4 | hidebackup
140 |
57 hg glog --template '{rev}: {desc}\n'
141 o 2: 'B'
58 echo "Expected A, B, C, D, E"
142 |
59 hg manifest
143 o 1: 'E'
144 |
145 o 0: 'A'
146
147 $ hg manifest
148 A
149 B
150 C
151 D
152 E
153
154 $ cd ..
155
156
157 Rebasing C onto E detaching from B and collapsing:
158
159 $ hg clone -q -u . a a4
160 $ cd a4
60
161
61 echo
162 $ hg tglog
62 createrepo > /dev/null 2>&1
163 @ 4: 'E'
63 hg glog --template '{rev}: {desc}\n'
164 |
64 echo '% Rebasing C onto E detaching from B and collapsing'
165 | o 3: 'D'
65 hg rebase --detach --collapse -s 2 -d 4 | hidebackup
166 | |
66 hg glog --template '{rev}: {desc}\n'
167 | o 2: 'C'
67 echo "Expected A, C, D, E"
168 | |
68 hg manifest
169 | o 1: 'B'
170 |/
171 o 0: 'A'
172
173 $ hg rebase --detach --collapse -s 2 -d 4
174 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
69
175
70 exit 0
176 $ hg tglog
177 @ 3: 'Collapsed revision
178 | * C
179 | * D'
180 o 2: 'E'
181 |
182 | o 1: 'B'
183 |/
184 o 0: 'A'
185
186 $ hg manifest
187 A
188 C
189 D
190 E
191
192 $ cd ..
193
@@ -1,83 +1,194 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
9
2
10
3 . $TESTDIR/helpers.sh
11 $ hg init a
4 echo "[extensions]" >> $HGRCPATH
12 $ cd a
5 echo "graphlog=" >> $HGRCPATH
6 echo "rebase=" >> $HGRCPATH
7
13
8 BASE=`pwd`
14 $ echo A > A
15 $ hg ci -Am A
16 adding A
17
18 $ echo B > B
19 $ hg ci -Am B
20 adding B
9
21
10 addcommit () {
22 $ echo C >> A
11 echo $1 > $1
23 $ hg ci -m C
12 hg add $1
24
13 hg commit -d "${2} 0" -m $1
25 $ hg up -q -C 0
14 }
26
27 $ echo D >> A
28 $ hg ci -m D
29 created new head
15
30
16 commit () {
31 $ echo E > E
17 hg commit -d "${2} 0" -m $1
32 $ hg ci -Am E
18 }
33 adding E
34
35 $ cd ..
36
37
38 Changes during an interruption - continue:
39
40 $ hg clone -q -u . a a1
41 $ cd a1
19
42
20 createrepo () {
43 $ hg tglog
21 cd $BASE
44 @ 4: 'E'
22 rm -rf a
45 |
23 hg init a
46 o 3: 'D'
24 cd a
47 |
25 addcommit "A" 0
48 | o 2: 'C'
26 addcommit "B" 1
49 | |
27 echo "C" >> A
50 | o 1: 'B'
28 commit "C" 2
51 |/
52 o 0: 'A'
53
54 Rebasing B onto E:
55
56 $ hg rebase -s 1 -d 4
57 merging A
58 warning: conflicts during merge.
59 merging A failed!
60 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
61 [255]
62
63 Force a commit on C during the interruption:
64
65 $ hg up -q -C 2
29
66
30 hg update -C 0
67 $ echo 'Extra' > Extra
31 echo "D" >> A
68 $ hg add Extra
32 commit "D" 3
69 $ hg ci -m 'Extra'
33 addcommit "E" 4
34 }
35
70
36 echo "% Changes during an interruption - continue"
71 $ hg tglog
37 createrepo > /dev/null 2>&1
72 @ 6: 'Extra'
38 hg glog --template '{rev}: {desc}\n'
73 |
74 | o 5: 'B'
75 | |
76 | o 4: 'E'
77 | |
78 | o 3: 'D'
79 | |
80 o | 2: 'C'
81 | |
82 o | 1: 'B'
83 |/
84 o 0: 'A'
85
86 Resume the rebasing:
87
88 $ hg rebase --continue
89 merging A
90 warning: conflicts during merge.
91 merging A failed!
92 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
93 [255]
94
95 Solve the conflict and go on:
39
96
40 echo
97 $ echo 'conflict solved' > A
41 echo "% - Rebasing B onto E"
98 $ rm A.orig
42 hg rebase -s 1 -d 4 | hidebackup
99 $ hg resolve -m A
43
100
44 echo
101 $ hg rebase --continue
45 echo "% - Force a commit on C during the interruption"
102 warning: new changesets detected on source branch, not stripping
46 hg update -C 2
47 addcommit "Extra" 5
48 hg glog --template '{rev}: {desc}\n'
49
103
50 echo
104 $ hg tglog
51 echo "% - Resume the rebasing"
105 @ 7: 'C'
52 hg rebase --continue
106 |
107 | o 6: 'Extra'
108 | |
109 o | 5: 'B'
110 | |
111 o | 4: 'E'
112 | |
113 o | 3: 'D'
114 | |
115 | o 2: 'C'
116 | |
117 | o 1: 'B'
118 |/
119 o 0: 'A'
120
121 $ cd ..
53
122
54 echo
123
55 echo "% - Solve the conflict and go on"
124 Changes during an interruption - abort:
56 echo 'conflict solved' > A
125
57 rm A.orig
126 $ hg clone -q -u . a a2
58 hg resolve -m A
127 $ cd a2
59 hg rebase --continue
128
60 hg glog --template '{rev}: {desc}\n'
129 $ hg tglog
130 @ 4: 'E'
131 |
132 o 3: 'D'
133 |
134 | o 2: 'C'
135 | |
136 | o 1: 'B'
137 |/
138 o 0: 'A'
139
140 Rebasing B onto E:
61
141
62 echo
142 $ hg rebase -s 1 -d 4
63 echo
143 merging A
64 echo "% Changes during an interruption - abort"
144 warning: conflicts during merge.
65 createrepo > /dev/null 2>&1
145 merging A failed!
66 hg glog --template '{rev}: {desc}\n'
146 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
147 [255]
67
148
68 echo
149 Force a commit on B' during the interruption:
69 echo "% Rebasing B onto E"
150
70 hg rebase -s 1 -d 4 | hidebackup
151 $ hg up -q -C 5
152
153 $ echo 'Extra' > Extra
154 $ hg add Extra
155 $ hg ci -m 'Extra'
71
156
72 echo
157 $ hg tglog
73 echo "% Force a commit on B' during the interruption"
158 @ 6: 'Extra'
74 hg update -C 5
159 |
75 addcommit "Extra" 6
160 o 5: 'B'
76 hg glog --template '{rev}: {desc}\n'
161 |
162 o 4: 'E'
163 |
164 o 3: 'D'
165 |
166 | o 2: 'C'
167 | |
168 | o 1: 'B'
169 |/
170 o 0: 'A'
171
172 Abort the rebasing:
77
173
78 echo
174 $ hg rebase --abort
79 echo "% Abort the rebasing"
175 warning: new changesets detected on target branch, can't abort
80 hg rebase --abort
176 [255]
81 hg glog --template '{rev}: {desc}\n'
82
177
83 exit 0
178 $ hg tglog
179 @ 6: 'Extra'
180 |
181 o 5: 'B'
182 |
183 o 4: 'E'
184 |
185 o 3: 'D'
186 |
187 | o 2: 'C'
188 | |
189 | o 1: 'B'
190 |/
191 o 0: 'A'
192
193 $ cd ..
194
@@ -1,51 +1,123 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
2
9
3 . $TESTDIR/helpers.sh
10
11 $ hg init a
12 $ cd a
4
13
5 echo "[extensions]" >> $HGRCPATH
14 $ echo c1 > c1
6 echo "graphlog=" >> $HGRCPATH
15 $ hg ci -Am c1
7 echo "rebase=" >> $HGRCPATH
16 adding c1
17
18 $ echo c2 > c2
19 $ hg ci -Am c2
20 adding c2
21
22 $ echo l1 > l1
23 $ hg ci -Am l1
24 adding l1
25
26 $ hg up -q -C 1
8
27
9 addcommit () {
28 $ echo r1 > r1
10 echo $1 > $1
29 $ hg ci -Am r1
11 hg add $1
30 adding r1
12 hg commit -d "${2} 0" -m $1
31 created new head
13 }
32
33 $ echo r2 > r2
34 $ hg ci -Am r2
35 adding r2
14
36
15 hg init a
37 $ hg tglog
16 cd a
38 @ 4: 'r2'
17 addcommit "c1" 0
39 |
18 addcommit "c2" 1
40 o 3: 'r1'
41 |
42 | o 2: 'l1'
43 |/
44 o 1: 'c2'
45 |
46 o 0: 'c1'
47
48 Rebase with no arguments - single revision in source branch:
19
49
20 addcommit "l1" 2
50 $ hg up -q -C 2
21
51
22 hg update -C 1
52 $ hg rebase
23 addcommit "r1" 3
53 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
24 addcommit "r2" 4
25 hg glog --template '{rev}:{desc}\n'
26
54
27 echo
55 $ hg tglog
28 echo '% Rebase with no arguments - single revision in source branch'
56 @ 4: 'l1'
29 hg update -C 2
57 |
30 hg rebase | hidebackup
58 o 3: 'r2'
31 hg glog --template '{rev}:{desc}\n'
59 |
60 o 2: 'r1'
61 |
62 o 1: 'c2'
63 |
64 o 0: 'c1'
65
66 $ cd ..
67
68
69 $ hg init b
70 $ cd b
32
71
33 cd ..
72 $ echo c1 > c1
34 rm -rf a
73 $ hg ci -Am c1
35 hg init a
74 adding c1
36 cd a
75
37 addcommit "c1" 0
76 $ echo c2 > c2
38 addcommit "c2" 1
77 $ hg ci -Am c2
78 adding c2
79
80 $ echo l1 > l1
81 $ hg ci -Am l1
82 adding l1
83
84 $ echo l2 > l2
85 $ hg ci -Am l2
86 adding l2
87
88 $ hg up -q -C 1
39
89
40 addcommit "l1" 2
90 $ echo r1 > r1
41 addcommit "l2" 3
91 $ hg ci -Am r1
92 adding r1
93 created new head
42
94
43 hg update -C 1
95 $ hg tglog
44 addcommit "r1" 4
96 @ 4: 'r1'
45 hg glog --template '{rev}:{desc}\n'
97 |
98 | o 3: 'l2'
99 | |
100 | o 2: 'l1'
101 |/
102 o 1: 'c2'
103 |
104 o 0: 'c1'
105
106 Rebase with no arguments - single revision in target branch:
107
108 $ hg up -q -C 3
46
109
47 echo
110 $ hg rebase
48 echo '% Rebase with no arguments - single revision in target branch'
111 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
49 hg update -C 3
112
50 hg rebase 2>&1 | hidebackup
113 $ hg tglog
51 hg glog --template '{rev}:{desc}\n'
114 @ 4: 'l2'
115 |
116 o 3: 'l1'
117 |
118 o 2: 'r1'
119 |
120 o 1: 'c2'
121 |
122 o 0: 'c1'
123
@@ -1,32 +1,71 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
2
9
3 echo "[extensions]" >> $HGRCPATH
10
4 echo "graphlog=" >> $HGRCPATH
11 $ hg init a
5 echo "rebase=" >> $HGRCPATH
12 $ cd a
13
14 $ echo c1 > c1
15 $ hg ci -Am c1
16 adding c1
6
17
7 addcommit () {
18 $ echo c2 > c2
8 echo $1 > $1
19 $ hg ci -Am c2
9 hg add $1
20 adding c2
10 hg commit -d "${2} 0" -m $1
21
11 }
22 $ echo l1 > l1
23 $ hg ci -Am l1
24 adding l1
25
26 $ echo l2 > l2
27 $ hg ci -Am l2
28 adding l2
29
30 $ hg up -q -C 1
31
32 $ hg branch 'notdefault'
33 marked working directory as branch notdefault
12
34
13 hg init a
35 $ echo r1 > r1
14 cd a
36 $ hg ci -Am r1
15 addcommit "c1" 0
37 adding r1
16 addcommit "c2" 1
17
38
18 addcommit "l1" 2
39 $ hg tglog
19 addcommit "l2" 3
40 @ 4: 'r1' notdefault
41 |
42 | o 3: 'l2'
43 | |
44 | o 2: 'l1'
45 |/
46 o 1: 'c2'
47 |
48 o 0: 'c1'
49
50
51 Rebase a branch while preserving the branch name:
20
52
21 hg update -C 1
53 $ hg up -q -C 3
22 hg branch 'notdefault'
54
23 addcommit "r1" 4
55 $ hg rebase -b 4 -d 3 --keepbranches
24 hg glog --template '{rev}:{desc}:{branches}\n'
56 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
25
57
26 echo
58 $ hg tglog
27 echo '% Rebase a branch while preserving the branch name'
59 @ 4: 'r1' notdefault
28 hg update -C 3
60 |
29 hg rebase -b 4 -d 3 --keepbranches -q
61 o 3: 'l2'
30 hg glog --template '{rev}:{desc}:{branches}\n'
62 |
31 echo '% dirstate branch should be "notdefault"'
63 o 2: 'l1'
32 hg branch
64 |
65 o 1: 'c2'
66 |
67 o 0: 'c1'
68
69 $ hg branch
70 notdefault
71
@@ -1,76 +1,136 b''
1 #!/bin/sh
1 This emulates the effects of an hg pull --rebase in which the remote repo
2 # This emulates the effects of an hg pull --rebase in which the remote repo
2 already has one local mq patch
3 # already has one local mq patch
4
3
5 . $TESTDIR/helpers.sh
4 $ cat >> $HGRCPATH <<EOF
5 > [extensions]
6 > graphlog=
7 > rebase=
8 > mq=
9 >
10 > [alias]
11 > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
12 > EOF
13
6
14
7 echo "[extensions]" >> $HGRCPATH
15 $ hg init a
8 echo "graphlog=" >> $HGRCPATH
16 $ cd a
9 echo "rebase=" >> $HGRCPATH
17 $ hg qinit -c
10 echo "mq=" >> $HGRCPATH
18
19 $ echo c1 > c1
20 $ hg add c1
21 $ hg ci -m C1
11
22
12 hg init a
23 $ echo r1 > r1
13 cd a
24 $ hg add r1
14 hg qinit -c # This must work even with a managed mq queue
25 $ hg ci -m R1
26
27 $ hg up -q 0
28
29 $ hg qnew p0.patch
30 $ echo p0 > p0
31 $ hg add p0
32 $ hg qref -m P0
15
33
16 echo 'c1' > c1
34 $ hg qnew p1.patch
17 hg add c1
35 $ echo p1 > p1
18 hg commit -d '0 0' -m "C1"
36 $ hg add p1
37 $ hg qref -m P1
38
39 $ hg export qtip > p1.patch
19
40
20 echo 'r1' > r1
41 $ hg up -q -C 1
21 hg add r1
42
22 hg commit -d '1 0' -m "R1"
43 $ hg import p1.patch
44 applying p1.patch
45
46 $ rm p1.patch
47
48 $ hg up -q -C qtip
23
49
24 hg up 0
50 $ hg rebase
25 hg qnew p0.patch
51 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
26 echo 'p0' > p0
27 hg add p0
28 hg qref -m 'P0'
29
52
30 hg qnew p1.patch
53 $ hg tglog
31 echo 'p1' > p1
54 @ 3: 'P0' tags: p0.patch qbase qtip tip
32 hg add p1
55 |
33 hg qref -m 'P1'
56 o 2: 'P1' tags: qparent
34 hg export qtip > p1.patch
57 |
58 o 1: 'R1' tags:
59 |
60 o 0: 'C1' tags:
61
62 $ cd ..
63
64
65 $ hg init b
66 $ cd b
67 $ hg qinit -c
35
68
36 echo
69 $ for i in r0 r1 r2 r3 r4 r5 r6;
37 echo '% "Mainstream" import p1.patch'
70 > do
38 hg up -C 1
71 > echo $i > $i
39 hg import p1.patch
72 > hg ci -Am $i
40 rm p1.patch
73 > done
74 adding r0
75 adding r1
76 adding r2
77 adding r3
78 adding r4
79 adding r5
80 adding r6
81
82 $ hg qimport -r 1:tip
41
83
42 echo
84 $ hg up -q 0
43 echo '% Rebase'
44 hg up -C qtip
45 hg rebase | hidebackup
46 hg glog --template '{rev} {desc} tags: {tags}\n'
47
85
48 echo
86 $ for i in r1 r3 r7 r8;
49 echo '% Now with --continue'
87 > do
50 cd ..
88 > echo $i > $i
51 hg init b
89 > hg ci -Am branch2-$i
52 cd b
90 > done
53 hg qinit -c # This must work even with a managed mq queue
91 adding r1
92 created new head
93 adding r3
94 adding r7
95 adding r8
96
97 $ echo somethingelse > r4
98 $ hg ci -Am branch2-r4
99 adding r4
54
100
55 for i in r0 r1 r2 r3 r4 r5 r6;
101 $ echo r6 > r6
56 do
102 $ hg ci -Am branch2-r6
57 echo $i > $i
103 adding r6
58 hg ci -Am $i
104
59 done
105 $ hg up -q qtip
60 hg qimport -r 1:tip
106
61 hg up 0
107 $ HGMERGE=internal:fail hg rebase
62 for i in r1 r3 r7 r8;
108 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
63 do
109 [255]
64 echo $i > $i
110
65 hg ci -Am branch2-$i
111 $ HGMERGE=internal:local hg resolve --all
66 done
112
67 echo somethingelse > r4
113 $ hg rebase --continue
68 hg ci -Am branch2-r4
114 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
69 echo r6 > r6
70 hg ci -Am branch2-r6
71
115
72 hg up qtip
116 $ hg tglog
73 HGMERGE=internal:fail hg rebase | hidebackup
117 @ 9: 'r5' tags: 5.diff qtip tip
74 HGMERGE=internal:local hg resolve --all
118 |
75 hg rebase --continue | hidebackup
119 o 8: 'r4' tags: 4.diff
76 hg glog --template '{rev} {desc} tags: {tags}\n'
120 |
121 o 7: 'r2' tags: 2.diff qbase
122 |
123 o 6: 'branch2-r6' tags: qparent
124 |
125 o 5: 'branch2-r4' tags:
126 |
127 o 4: 'branch2-r8' tags:
128 |
129 o 3: 'branch2-r7' tags:
130 |
131 o 2: 'branch2-r3' tags:
132 |
133 o 1: 'branch2-r1' tags:
134 |
135 o 0: 'r0' tags:
136
@@ -1,133 +1,237 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4 > rebase=
5 > mq=
6 >
7 > [mq]
8 > plain=true
9 >
10 > [alias]
11 > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
12 > EOF
4
13
5 echo "[extensions]" >> $HGRCPATH
14
6 echo "graphlog=" >> $HGRCPATH
15 $ hg init a
7 echo "rebase=" >> $HGRCPATH
16 $ cd a
8 echo "mq=" >> $HGRCPATH
17 $ hg qinit -c
9
18
10 echo "[mq]" >> $HGRCPATH
19 $ echo c1 > f
11 echo "plain=true" >> $HGRCPATH
20 $ hg add f
21 $ hg ci -m C1
22
23 $ echo r1 > f
24 $ hg ci -m R1
25
26 $ hg up -q 0
12
27
13 filterpatch()
28 $ hg qnew f.patch
14 {
29 $ echo mq1 > f
15 sed -e "s/^\(# Date\).*/\1/" \
30 $ hg qref -m P0
16 -e "s/^\(# Node ID\).*/\1/" \
31
17 -e "s/^\(# Parent\).*/\1/" \
32 $ hg qnew f2.patch
18 -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
33 $ echo mq2 > f
19 -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \
34 $ hg qref -m P1
20 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
21 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
22 }
23
35
24 hg init a
36 $ hg tglog
25 cd a
37 @ 3: 'P1' tags: f2.patch qtip tip
26 hg qinit -c # This must work even with a managed mq queue
38 |
39 o 2: 'P0' tags: f.patch qbase
40 |
41 | o 1: 'R1' tags:
42 |/
43 o 0: 'C1' tags: qparent
44
45
46 Rebase - try to rebase on an applied mq patch:
27
47
28 echo 'c1' > f
48 $ hg rebase -s 1 -d 3
29 hg add f
49 abort: cannot rebase onto an applied mq patch
30 hg commit -d '0 0' -m "C1"
50 [255]
51
52 Rebase - same thing, but mq patch is default dest:
53
54 $ hg up -q 1
55 $ hg rebase
56 abort: cannot rebase onto an applied mq patch
57 [255]
58 $ hg up -q qtip
31
59
32 echo 'r1' > f
60 Rebase - generate a conflict:
33 hg commit -d '2 0' -m "R1"
61
62 $ hg rebase -s 2 -d 1
63 merging f
64 warning: conflicts during merge.
65 merging f failed!
66 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
67 [255]
68
69 Fix the 1st conflict:
34
70
35 hg up 0
71 $ echo mq1r1 > f
36 hg qnew f.patch
72 $ hg resolve -m f
37 echo 'mq1' > f
73 $ hg rebase -c
38 hg qref -m 'P0'
74 merging f
75 warning: conflicts during merge.
76 merging f failed!
77 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
78 [255]
39
79
40 hg qnew f2.patch
80 Fix the 2nd conflict:
41 echo 'mq2' > f
81
42 hg qref -m 'P1'
82 $ echo mq1r1mq2 > f
43 hg glog --template '{rev} {desc} tags: {tags}\n'
83 $ hg resolve -m f
84 $ hg rebase -c
85 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
44
86
45 echo
87 $ hg tglog
46 echo '% Rebase - try to rebase on an applied mq patch'
88 @ 3: 'P1' tags: f2.patch qtip tip
47 hg rebase -s 1 -d 3
89 |
90 o 2: 'P0' tags: f.patch qbase
91 |
92 o 1: 'R1' tags: qparent
93 |
94 o 0: 'C1' tags:
95
96 $ hg up -q qbase
48
97
49 echo
98 $ cat f
50 echo '% Rebase - same thing, but mq patch is default dest'
99 mq1r1
51 hg update -q 1
52 hg rebase
53 hg update -q qtip
54
100
55 echo
101 $ cat .hg/patches/f.patch
56 echo '% Rebase - generate a conflict'
102 # HG changeset patch
57 hg rebase -s 2 -d 1
103 # User test
104 # Date ?????????? ? (glob)
105 # Node ID ???????????????????????????????????????? (glob)
106 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
107 P0
108
109 diff -r bac9ed9960d8 -r ???????????? f (glob)
110 --- a/f Thu Jan 01 00:00:00 1970 +0000
111 +++ b/f ??? ??? ?? ??:??:?? ???? ????? (glob)
112 @@ -1,1 +1,1 @@
113 -r1
114 +mq1r1
58
115
59 echo
116 Update to qtip:
60 echo '% Fix the 1st conflict'
117
61 echo 'mq1r1' > f
118 $ hg up -q qtip
62 hg resolve -m f
63 hg rebase -c | hidebackup
64
119
65 echo
120 $ cat f
66 echo '% Fix the 2nd conflict'
121 mq1r1mq2
67 echo 'mq1r1mq2' > f
68 hg resolve -m f
69 hg rebase -c | hidebackup
70
122
71 hg glog --template '{rev} {desc} tags: {tags}\n'
123 $ cat .hg/patches/f2.patch
124 # HG changeset patch
125 # User test
126 # Date ?????????? ? (glob)
127 # Node ID ???????????????????????????????????????? (glob)
128 # Parent ???????????????????????????????????????? (glob)
129 P1
130
131 diff -r ???????????? -r ???????????? f (glob)
132 --- a/f ??? ??? ?? ??:??:?? ???? ????? (glob)
133 +++ b/f ??? ??? ?? ??:??:?? ???? ????? (glob)
134 @@ -1,1 +1,1 @@
135 -mq1r1
136 +mq1r1mq2
137
138 Adding one git-style patch and one normal:
139
140 $ hg qpop -a
141 popping f2.patch
142 popping f.patch
143 patch queue now empty
72
144
73 echo
145 $ rm -fr .hg/patches
74 echo '% Update to qbase'
146 $ hg qinit -c
75 hg up qbase
147
76 echo '% f correctly reflects the merge result'
148 $ hg up -q 0
77 cat f
149
78 echo '% And the patch is correct'
150 $ hg qnew --git f_git.patch
79 cat .hg/patches/f.patch | filterpatch
151 $ echo mq1 > p
152 $ hg add p
153 $ hg qref --git -m 'P0 (git)'
80
154
81 echo
155 $ hg qnew f.patch
82 echo '% Update to qtip'
156 $ echo mq2 > p
83 hg up qtip
157 $ hg qref -m P1
84 echo '% f correctly reflects the merge result'
158 $ hg qci -m 'save patch state'
85 cat f
86 echo '% And the patch is correct'
87 cat .hg/patches/f2.patch | filterpatch
88
159
89 echo
160 $ hg qseries -s
90 echo '% Adding one git-style patch and one normal'
161 f_git.patch: P0 (git)
91 hg qpop -a
162 f.patch: P1
92 rm -fr .hg/patches
163
93 hg qinit -c
164 $ hg -R .hg/patches manifest
165 .hgignore
166 f.patch
167 f_git.patch
168 series
94
169
95 hg up 0
170 $ cat .hg/patches/f_git.patch
96 hg qnew --git f_git.patch
171 P0 (git)
97 echo 'mq1' > p
172
98 hg add p
173 diff --git a/p b/p
99 hg qref --git -m 'P0 (git)'
174 new file mode 100644
175 --- /dev/null
176 +++ b/p
177 @@ -0,0 +1,1 @@
178 +mq1
100
179
101 hg qnew f.patch
180 $ cat .hg/patches/f.patch
102 echo 'mq2' > p
181 P1
103 hg qref -m 'P1'
182
104 hg qcommit -m 'save patch state'
183 diff -r ???????????? p (glob)
105 echo '% patch series step 1/2'
184 --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob)
106 hg qseries -s
185 +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob)
107 echo '% patch queue manifest step 1/2'
186 @@ -1,1 +1,1 @@
108 hg -R .hg/patches manifest
187 -mq1
188 +mq2
189
109
190
110 echo '% Git patch'
191 Rebase the applied mq patches:
111 cat .hg/patches/f_git.patch | filterpatch
192
193 $ hg rebase -s 2 -d 1
194 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
195
196 $ hg qci -m 'save patch state'
197
198 $ hg qseries -s
199 f_git.patch: P0 (git)
200 f.patch: P1
112
201
113 echo
202 $ hg -R .hg/patches manifest
114 echo '% Normal patch'
203 .hgignore
115 cat .hg/patches/f.patch | filterpatch
204 f.patch
205 f_git.patch
206 series
116
207
117 echo
208 $ cat .hg/patches/f_git.patch
118 echo '% Rebase the applied mq patches'
209 # HG changeset patch
119 hg rebase -s 2 -d 1 --quiet
210 # User test
120 hg qcommit -m 'save patch state'
211 # Date ?????????? ? (glob)
121 echo '% patch series step 2/2'
212 # Node ID ???????????????????????????????????????? (glob)
122 hg qseries -s
213 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
123 echo '% patch queue manifest step 2/2'
214 P0 (git)
124 hg -R .hg/patches manifest
215
216 diff --git a/p b/p
217 new file mode 100644
218 --- /dev/null
219 +++ b/p
220 @@ -0,0 +1,1 @@
221 +mq1
125
222
126 echo '% And the patches are correct'
223 $ cat .hg/patches/f.patch
127 echo '% Git patch'
224 # HG changeset patch
128 cat .hg/patches/f_git.patch | filterpatch
225 # User test
226 # Date ?????????? ? (glob)
227 # Node ID ???????????????????????????????????????? (glob)
228 # Parent ???????????????????????????????????????? (glob)
229 P1
230
231 diff -r ???????????? -r ???????????? p (glob)
232 --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob)
233 +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob)
234 @@ -1,1 +1,1 @@
235 -mq1
236 +mq2
129
237
130 echo
131 echo '% Normal patch'
132 cat .hg/patches/f.patch | filterpatch
133
@@ -1,33 +1,54 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 . $TESTDIR/helpers.sh
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
4
9
5 echo "[extensions]" >> $HGRCPATH
10 $ hg init repo
6 echo "graphlog=" >> $HGRCPATH
11 $ cd repo
7 echo "rebase=" >> $HGRCPATH
8
12
9 rm -rf repo
13 $ echo A > a
10 hg init repo
14 $ echo >> a
11 cd repo
15 $ hg ci -Am A
16 adding a
12
17
13 echo A > a
18 $ echo B > a
14 echo >> a
19 $ echo >> a
15 hg commit -AmA -u test -d '0 0'
20 $ hg ci -m B
21
22 $ echo C > a
23 $ echo >> a
24 $ hg ci -m C
25
26 $ hg up -q -C 0
16
27
17 echo B > a
28 $ echo D >> a
18 echo >> a
29 $ hg ci -Am AD
19 hg commit -mB -u test -d '1 0'
30 created new head
20
21 echo C > a
22 echo >> a
23 hg commit -mC -u test -d '2 0'
24
31
25 hg up -C 0
32 $ hg tglog
26 echo D >> a
33 @ 3: 'AD'
27 hg commit -AmAD -u test -d '3 0'
34 |
35 | o 2: 'C'
36 | |
37 | o 1: 'B'
38 |/
39 o 0: 'A'
40
41 $ hg rebase -s 1 -d 3
42 merging a
43 merging a
44 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
28
45
29 hg glog --template '{rev}:{desc} {node|short}\n'
46 $ hg tglog
30 hg rebase -q -s 1 -d 3 | hidebackup
47 @ 3: 'C'
31 hg glog --template '{rev}:{desc} {node|short}\n'
48 |
32
49 o 2: 'B'
33 exit 0
50 |
51 o 1: 'AD'
52 |
53 o 0: 'A'
54
@@ -1,110 +1,332 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
9
10
11 $ hg init a
12 $ cd a
13
14 $ echo c1 > c1
15 $ hg ci -Am c1
16 adding c1
2
17
3 . $TESTDIR/helpers.sh
18 $ echo c2 > c2
19 $ hg ci -Am c2
20 adding c2
21
22 $ echo c3 > c3
23 $ hg ci -Am c3
24 adding c3
4
25
5 echo "[extensions]" >> $HGRCPATH
26 $ hg up -q -C 1
6 echo "rebase=" >> $HGRCPATH
27
28 $ echo l1 > l1
29 $ hg ci -Am l1
30 adding l1
31 created new head
32
33 $ echo l2 > l2
34 $ hg ci -Am l2
35 adding l2
7
36
8 addcommit () {
37 $ echo l3 > l3
9 echo $1 > $1
38 $ hg ci -Am l3
10 hg add $1
39 adding l3
11 hg commit -d "${2} 0" -m $1
40
12 }
41 $ hg up -q -C 2
42
43 $ echo r1 > r1
44 $ hg ci -Am r1
45 adding r1
46
47 $ echo r2 > r2
48 $ hg ci -Am r2
49 adding r2
13
50
14 commit () {
51 $ hg tglog
15 hg commit -d "${2} 0" -m $1
52 @ 7: 'r2'
16 }
53 |
54 o 6: 'r1'
55 |
56 | o 5: 'l3'
57 | |
58 | o 4: 'l2'
59 | |
60 | o 3: 'l1'
61 | |
62 o | 2: 'c3'
63 |/
64 o 1: 'c2'
65 |
66 o 0: 'c1'
67
68 $ cd ..
17
69
18 createrepo () {
70
19 hg init a
71 These fail:
20 cd a
72
21 addcommit "c1" 0
73 $ hg clone -q -u . a a1
22 addcommit "c2" 1
74 $ cd a1
23 addcommit "c3" 2
75
76 $ hg rebase --continue --abort
77 abort: cannot use both abort and continue
78 [255]
24
79
25 hg update -C 1
80 $ hg rebase --continue --collapse
26 addcommit "l1" 3
81 abort: cannot use collapse with continue or abort
27 addcommit "l2" 4
82 [255]
28 addcommit "l3" 5
83
84 $ hg rebase --continue --dest 4
85 abort: abort and continue do not allow specifying revisions
86 [255]
87
88 $ hg rebase --base 5 --source 4
89 abort: cannot specify both a revision and a base
90 [255]
91
92 $ hg rebase
93 nothing to rebase
94 [1]
29
95
30 hg update -C 2
96 $ hg up -q 6
31 addcommit "r1" 6
97
32 addcommit "r2" 7
98 $ hg rebase
33 }
99 nothing to rebase
100 [1]
101
102
103 These work:
104
105 Rebase with no arguments (from 3 onto 7):
106
107 $ hg up -q -C 5
108
109 $ hg rebase
110 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
34
111
35 createrepo > /dev/null 2>&1
112 $ hg tglog
36 echo "% These fail"
113 @ 7: 'l3'
37 echo
114 |
38 echo "% Use continue and abort"
115 o 6: 'l2'
39 hg rebase --continue --abort
116 |
117 o 5: 'l1'
118 |
119 o 4: 'r2'
120 |
121 o 3: 'r1'
122 |
123 o 2: 'c3'
124 |
125 o 1: 'c2'
126 |
127 o 0: 'c1'
128
129 Try to rollback after a rebase (fail):
130
131 $ hg rollback
132 no rollback information available
133 [1]
134
135 $ cd ..
136
40
137
41 echo
138 Rebase with base == '.' => same as no arguments (from 3 onto 7):
42 echo "% Use continue and collapse"
139
43 hg rebase --continue --collapse
140 $ hg clone -q -u 5 a a2
141 $ cd a2
142
143 $ hg rebase --base .
144 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
44
145
45 echo
146 $ hg tglog
46 echo "% Use continue/abort and dest/source"
147 @ 7: 'l3'
47 hg rebase --continue --dest 4
148 |
149 o 6: 'l2'
150 |
151 o 5: 'l1'
152 |
153 o 4: 'r2'
154 |
155 o 3: 'r1'
156 |
157 o 2: 'c3'
158 |
159 o 1: 'c2'
160 |
161 o 0: 'c1'
162
163 $ cd ..
48
164
49 echo
50 echo "% Use source and base"
51 hg rebase --base 5 --source 4
52
165
53 echo
166 Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7):
54 echo "% Rebase with no arguments - from current"
167
55 hg rebase
168 $ hg clone -q -u 5 a a3
169 $ cd a3
170
171 $ hg rebase --dest `hg branch`
172 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
56
173
57 echo
174 $ hg tglog
58 echo "% Rebase with no arguments - from the current branch"
175 @ 7: 'l3'
59 hg update 6
176 |
60 hg rebase
177 o 6: 'l2'
178 |
179 o 5: 'l1'
180 |
181 o 4: 'r2'
182 |
183 o 3: 'r1'
184 |
185 o 2: 'c3'
186 |
187 o 1: 'c2'
188 |
189 o 0: 'c1'
190
191 $ cd ..
192
193
194 Specify only source (from 4 onto 7):
195
196 $ hg clone -q -u . a a4
197 $ cd a4
198
199 $ hg rebase --source 4
200 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
61
201
62 echo "% ----------"
202 $ hg tglog
63 echo "% These work"
203 @ 7: 'l3'
64 echo
204 |
65 echo "% Rebase with no arguments (from 3 onto 7)"
205 o 6: 'l2'
66 hg update -C 5
206 |\
67 hg rebase 2>&1 | hidebackup
207 | o 5: 'r2'
208 | |
209 | o 4: 'r1'
210 | |
211 o | 3: 'l1'
212 | |
213 | o 2: 'c3'
214 |/
215 o 1: 'c2'
216 |
217 o 0: 'c1'
218
219 $ cd ..
220
221
222 Specify only dest (from 3 onto 6):
68
223
69 echo "% Try to rollback after a rebase (fail)"
224 $ hg clone -q -u 5 a a5
70 hg rollback
225 $ cd a5
226
227 $ hg rebase --dest 6
228 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
71
229
72 createrepo > /dev/null 2>&1
230 $ hg tglog
73 echo
231 @ 7: 'l3'
74 echo "% Rebase with base == '.' => same as no arguments (from 3 onto 7)"
232 |
75 hg update -C 5
233 o 6: 'l2'
76 hg rebase --base . | hidebackup
234 |
235 o 5: 'l1'
236 |
237 | o 4: 'r2'
238 |/
239 o 3: 'r1'
240 |
241 o 2: 'c3'
242 |
243 o 1: 'c2'
244 |
245 o 0: 'c1'
246
247 $ cd ..
248
77
249
78 createrepo > /dev/null 2>&1
250 Specify only base (from 3 onto 7):
79 echo
251
80 echo "% Rebase with dest == `hg branch` => same as no arguments (from 3 onto 7)"
252 $ hg clone -q -u . a a6
81 hg update -C 5
253 $ cd a6
82 hg rebase --dest `hg branch` | hidebackup
254
255 $ hg rebase --base 5
256 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
83
257
84 createrepo > /dev/null 2>&1
258 $ hg tglog
85 echo
259 @ 7: 'l3'
86 echo "% Specify only source (from 4 onto 7)"
260 |
87 hg rebase --source 4 | hidebackup
261 o 6: 'l2'
262 |
263 o 5: 'l1'
264 |
265 o 4: 'r2'
266 |
267 o 3: 'r1'
268 |
269 o 2: 'c3'
270 |
271 o 1: 'c2'
272 |
273 o 0: 'c1'
274
275 $ cd ..
88
276
89 createrepo > /dev/null 2>&1
277
90 echo
278 Specify source and dest (from 4 onto 6):
91 echo "% Specify only dest (from 3 onto 6)"
279
92 hg update -C 5
280 $ hg clone -q -u . a a7
93 hg rebase --dest 6 | hidebackup
281 $ cd a7
282
283 $ hg rebase --source 4 --dest 6
284 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
94
285
95 createrepo > /dev/null 2>&1
286 $ hg tglog
96 echo
287 @ 7: 'l3'
97 echo "% Specify only base (from 3 onto 7)"
288 |
98 hg rebase --base 5 | hidebackup
289 o 6: 'l2'
290 |\
291 | | o 5: 'r2'
292 | |/
293 | o 4: 'r1'
294 | |
295 o | 3: 'l1'
296 | |
297 | o 2: 'c3'
298 |/
299 o 1: 'c2'
300 |
301 o 0: 'c1'
302
303 $ cd ..
304
305
306 Specify base and dest (from 3 onto 6):
99
307
100 createrepo > /dev/null 2>&1
308 $ hg clone -q -u . a a8
101 echo
309 $ cd a8
102 echo "% Specify source and dest (from 4 onto 6)"
310
103 hg rebase --source 4 --dest 6 | hidebackup
311 $ hg rebase --base 4 --dest 6
312 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
104
313
105 createrepo > /dev/null 2>&1
314 $ hg tglog
106 echo
315 @ 7: 'l3'
107 echo "% Specify base and dest (from 3 onto 6)"
316 |
108 hg rebase --base 4 --dest 6 | hidebackup
317 o 6: 'l2'
318 |
319 o 5: 'l1'
320 |
321 | o 4: 'r2'
322 |/
323 o 3: 'r1'
324 |
325 o 2: 'c3'
326 |
327 o 1: 'c2'
328 |
329 o 0: 'c1'
330
331 $ cd ..
109
332
110 exit 0
@@ -1,63 +1,113 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
2
9
3 . $TESTDIR/helpers.sh
4
10
5 echo "[extensions]" >> $HGRCPATH
11 $ hg init a
6 echo "graphlog=" >> $HGRCPATH
12 $ cd a
7 echo "rebase=" >> $HGRCPATH
8
13
9 addcommit () {
14 $ echo C1 > C1
10 echo $1 > $1
15 $ hg ci -Am C1
11 hg add $1
16 adding C1
12 hg commit -d "${2} 0" -m $1
17
13 }
18 $ echo C2 > C2
19 $ hg ci -Am C2
20 adding C2
21
22 $ cd ..
14
23
15 commit () {
24 $ hg clone a b
16 hg commit -d "${2} 0" -m $1
25 updating to branch default
17 }
26 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
27
28 $ hg clone a c
29 updating to branch default
30 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
31
32 $ cd b
18
33
19 rm -rf a
34 $ echo L1 > L1
20 hg init a
35 $ hg ci -Am L1
21 cd a
36 adding L1
22 addcommit "C1" 0
37
23 addcommit "C2" 1
38
39 $ cd ../a
24
40
25 cd ..
41 $ echo R1 > R1
26 hg clone a b
42 $ hg ci -Am R1
27 # This is needed to test pull --rebase
43 adding R1
28 hg clone a c
29
44
30 cd b
45
31 addcommit "L1" 2
46 $ cd ../b
47
48 Now b has one revision to be pulled from a:
32
49
33 cd ../a
50 $ hg pull --rebase
34 addcommit "R1" 3
51 pulling from */a (glob)
52 searching for changes
53 adding changesets
54 adding manifests
55 adding file changes
56 added 1 changesets with 1 changes to 1 files (+1 heads)
57 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
35
58
36 cd ../b
59 $ hg tglog
37 echo
60 @ 3: 'L1'
38 echo "% Now b has one revision to be pulled from a"
61 |
39 hg pull --rebase | hidebackup | sed -e 's/\(pulling from \).*/\1/'
62 o 2: 'R1'
63 |
64 o 1: 'C2'
65 |
66 o 0: 'C1'
67
68 Re-run:
40
69
41 hg glog --template '{rev}:{desc}\n'
70 $ hg pull --rebase
71 pulling from */a (glob)
72 searching for changes
73 no changes found
42
74
43 echo
75
44 echo "% Re-run pull --rebase"
76 Invoke pull --rebase and nothing to rebase:
45 hg pull --rebase | sed 's/\(pulling from \).*/\1/'
77
78 $ cd ../c
46
79
47 echo
80 $ hg pull --rebase
48 echo "% Invoke pull --rebase and nothing to rebase"
81 pulling from */a (glob)
49 cd ../c
82 searching for changes
50 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/'
83 adding changesets
51 hg glog --template '{rev}\n' -l 1
84 adding manifests
85 adding file changes
86 added 1 changesets with 1 changes to 1 files
87 nothing to rebase
88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89
90 $ hg tglog -l 1
91 @ 2: 'R1'
92 |
93
94 pull --rebase --update should ignore --update:
52
95
53 echo
96 $ hg pull --rebase --update
54 echo "% pull --rebase --update should ignore --update"
97 pulling from */a (glob)
55 hg pull --rebase --update 2>&1 | sed 's/\(pulling from \).*/\1/'
98 searching for changes
99 no changes found
100
101 pull --rebase doesn't update if nothing has been pulled:
102
103 $ hg up -q 1
56
104
57 echo
105 $ hg pull --rebase
58 echo "% pull --rebase doesn't update if nothing has been pulled"
106 pulling from */a (glob)
59 hg up 1
107 searching for changes
60 hg pull --rebase 2>&1 | sed 's/\(pulling from \).*/\1/'
108 no changes found
61 hg glog --template '{rev}\n' -l 1
62
109
63 exit 0
110 $ hg tglog -l 1
111 o 2: 'R1'
112 |
113
@@ -1,55 +1,121 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tlog = log --template "{rev}: '{desc}' {branches}\n"
8 > tglog = tlog --graph
9 > EOF
2
10
3 . $TESTDIR/helpers.sh
11
12 $ hg init a
13 $ cd a
4
14
5 echo "[extensions]" >> $HGRCPATH
15 $ echo a > a
6 echo "rebase=" >> $HGRCPATH
16 $ hg ci -Am A
7 echo "[diff]" >> $HGRCPATH
17 adding a
8 echo "git=1" >> $HGRCPATH
9
18
10 BASE=`pwd`
19 $ echo b > b
20 $ hg ci -Am B
21 adding b
22
23 $ hg up -q -C 0
24
25 $ hg mv a a-renamed
26
27 $ hg ci -m 'rename A'
28 created new head
11
29
12 hg init repo1
30 $ hg tglog
13 cd repo1
31 @ 2: 'rename A'
14 echo "a">a
32 |
15 hg commit -Am "A" --date '0 0'
33 | o 1: 'B'
16 echo "b"> b
34 |/
17 hg commit -Am "B" --date '1 0'
35 o 0: 'A'
18 hg up -C 0
36
19 hg mv a a-renamed
37
20 hg commit -m 'rename A' --date '2 0'
38 Rename is tracked:
21
39
22 echo
40 $ hg tlog -p --git -r tip
23 echo '% Rename is tracked'
41 2: 'rename A'
24 hg log -p -r tip --template '{rev}:{desc}\n'
42 diff --git a/a b/a-renamed
43 rename from a
44 rename to a-renamed
45
46 Rebase the revision containing the rename:
25
47
26 echo '% Rebase the revision containing the rename'
48 $ hg rebase -s 2 -d 1
27 hg rebase -s 2 -d 1 --quiet | cleanrebase
49 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
50
51 $ hg tglog
52 @ 2: 'rename A'
53 |
54 o 1: 'B'
55 |
56 o 0: 'A'
57
58
59 Rename is not lost:
28
60
29 echo
61 $ hg tlog -p --git -r tip
30 echo '% Rename is not lost'
62 2: 'rename A'
31 hg log -p -r tip --template '{rev}:{desc}\n'
63 diff --git a/a b/a-renamed
64 rename from a
65 rename to a-renamed
66
67 $ cd ..
68
69
70 $ hg init b
71 $ cd b
72
73 $ echo a > a
74 $ hg ci -Am A
75 adding a
76
77 $ echo b > b
78 $ hg ci -Am B
79 adding b
80
81 $ hg up -q -C 0
82
83 $ hg cp a a-copied
84 $ hg ci -m 'copy A'
85 created new head
32
86
33 cd $BASE
87 $ hg tglog
34 rm -rf repo1
88 @ 2: 'copy A'
35 hg init repo1
89 |
36 cd repo1
90 | o 1: 'B'
37 echo "a">a
91 |/
38 hg commit -Am "A" --date '0 0'
92 o 0: 'A'
39 echo "b"> b
93
40 hg commit -Am "B" --date '1 0'
94 Copy is tracked:
41 hg up -C 0
95
42 hg cp a a-copied
96 $ hg tlog -p --git -r tip
43 hg commit -m 'copy A' --date '2 0'
97 2: 'copy A'
98 diff --git a/a b/a-copied
99 copy from a
100 copy to a-copied
101
102 Rebase the revision containing the copy:
44
103
45 echo
104 $ hg rebase -s 2 -d 1
46 echo '% Copy is tracked'
105 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
47 hg log -p -r tip --template '{rev}:{desc}\n'
48
106
49 echo '% Rebase the revision containing the copy'
107 $ hg tglog
50 hg rebase -s 2 -d 1 --quiet | cleanrebase
108 @ 2: 'copy A'
109 |
110 o 1: 'B'
111 |
112 o 0: 'A'
113
114 Copy is not lost:
51
115
52 echo
116 $ hg tlog -p --git -r tip
53 echo '% Copy is not lost'
117 2: 'copy A'
54 hg log -p -r tip --template '{rev}:{desc}\n'
118 diff --git a/a b/a-copied
55
119 copy from a
120 copy to a-copied
121
@@ -1,93 +1,249 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
2
9
3 . $TESTDIR/helpers.sh
10
11 $ hg init a
12 $ cd a
4
13
5 echo "[extensions]" >> $HGRCPATH
14 $ echo A > A
6 echo "graphlog=" >> $HGRCPATH
15 $ hg ci -Am A
7 echo "rebase=" >> $HGRCPATH
16 adding A
8
17
9 BASE=`pwd`
18 $ echo B > B
19 $ hg ci -Am B
20 adding B
21
22 $ hg up -q -C 0
23
24 $ echo C > C
25 $ hg ci -Am C
26 adding C
27 created new head
10
28
11 addcommit () {
29 $ hg up -q -C 0
12 echo $1 > $1
30
13 hg add $1
31 $ echo D > D
14 hg commit -d "${2} 0" -m $1
32 $ hg ci -Am D
15 }
33 adding D
34 created new head
35
36 $ hg merge -r 2
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 (branch merge, don't forget to commit)
39
40 $ hg ci -m E
16
41
17 commit () {
42 $ hg up -q -C 3
18 hg commit -d "${2} 0" -m $1
43
19 }
44 $ echo F > F
45 $ hg ci -Am F
46 adding F
47 created new head
48
49 $ cd ..
50
51
52 Rebasing
53 B onto F - simple rebase:
54
55 $ hg clone -q -u . a a1
56 $ cd a1
20
57
21 createrepo () {
58 $ hg tglog
22 cd $BASE
59 @ 5: 'F'
23 rm -rf a
60 |
24 hg init a
61 | o 4: 'E'
25 cd a
62 |/|
26 addcommit "A" 0
63 o | 3: 'D'
27 addcommit "B" 1
64 | |
65 | o 2: 'C'
66 |/
67 | o 1: 'B'
68 |/
69 o 0: 'A'
70
71 $ hg rebase -s 1 -d 5
72 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
28
73
29 hg update -C 0
74 $ hg tglog
30 addcommit "C" 2
75 @ 5: 'B'
76 |
77 o 4: 'F'
78 |
79 | o 3: 'E'
80 |/|
81 o | 2: 'D'
82 | |
83 | o 1: 'C'
84 |/
85 o 0: 'A'
86
87 $ cd ..
88
31
89
32 hg update -C 0
90 B onto D - intermediate point:
33 addcommit "D" 3
34
91
35 hg merge -r 2
92 $ hg clone -q -u . a a2
36 commit "E" 4
93 $ cd a2
94
95 $ hg rebase -s 1 -d 3
96 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
37
97
38 hg update -C 3
98 $ hg tglog
39 addcommit "F" 5
99 @ 5: 'B'
40 }
100 |
101 | o 4: 'F'
102 |/
103 | o 3: 'E'
104 |/|
105 o | 2: 'D'
106 | |
107 | o 1: 'C'
108 |/
109 o 0: 'A'
110
111 $ cd ..
41
112
42 createrepo > /dev/null 2>&1
113
43 hg glog --template '{rev}: {desc}\n'
114 C onto F - skip of E:
115
116 $ hg clone -q -u . a a3
117 $ cd a3
118
119 $ hg rebase -s 2 -d 5
120 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
44
121
45 echo '% Rebasing'
122 $ hg tglog
46 echo '% B onto F - simple rebase'
123 @ 4: 'C'
47 hg rebase -s 1 -d 5 | hidebackup
124 |
48 hg glog --template '{rev}: {desc}\n'
125 o 3: 'F'
126 |
127 o 2: 'D'
128 |
129 | o 1: 'B'
130 |/
131 o 0: 'A'
132
133 $ cd ..
49
134
50 createrepo > /dev/null 2>&1
135
51 echo '% B onto D - intermediate point'
136 D onto C - rebase of a branching point (skip E):
52 hg rebase -s 1 -d 3 | hidebackup
137
53 hg glog --template '{rev}: {desc}\n'
138 $ hg clone -q -u . a a4
139 $ cd a4
140
141 $ hg rebase -s 3 -d 2
142 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
54
143
55 createrepo > /dev/null 2>&1
144 $ hg tglog
56 echo '% C onto F - skip of E'
145 @ 4: 'F'
57 hg rebase -s 2 -d 5 | hidebackup
146 |
58 hg glog --template '{rev}: {desc}\n'
147 o 3: 'D'
148 |
149 o 2: 'C'
150 |
151 | o 1: 'B'
152 |/
153 o 0: 'A'
154
155 $ cd ..
156
157
158 E onto F - merged revision having a parent in ancestors of target:
159
160 $ hg clone -q -u . a a5
161 $ cd a5
59
162
60 createrepo > /dev/null 2>&1
163 $ hg rebase -s 4 -d 5
61 echo '% D onto C - rebase of a branching point (skip E)'
164 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
62 hg rebase -s 3 -d 2 | hidebackup
63 hg glog --template '{rev}: {desc}\n'
64
165
65 createrepo > /dev/null 2>&1
166 $ hg tglog
66 echo '% E onto F - merged revision having a parent in ancestors of target'
167 @ 5: 'E'
67 hg rebase -s 4 -d 5 | hidebackup
168 |\
68 hg glog --template '{rev}: {desc}\n'
169 | o 4: 'F'
170 | |
171 | o 3: 'D'
172 | |
173 o | 2: 'C'
174 |/
175 | o 1: 'B'
176 |/
177 o 0: 'A'
178
179 $ cd ..
180
181
182 D onto B - E maintains C as parent:
69
183
70 createrepo > /dev/null 2>&1
184 $ hg clone -q -u . a a6
71 echo '% D onto B - E maintains C as parent'
185 $ cd a6
72 hg rebase -s 3 -d 1 | hidebackup
186
73 hg glog --template '{rev}: {desc}\n'
187 $ hg rebase -s 3 -d 1
188 saved backup bundle to */.hg/strip-backup/*-backup.hg (glob)
189
190 $ hg tglog
191 @ 5: 'F'
192 |
193 | o 4: 'E'
194 |/|
195 o | 3: 'D'
196 | |
197 | o 2: 'C'
198 | |
199 o | 1: 'B'
200 |/
201 o 0: 'A'
202
203 $ cd ..
204
205
206 These will fail (using --source):
207
208 E onto D - rebase onto an ancestor:
209
210 $ hg clone -q -u . a a7
211 $ cd a7
212
213 $ hg rebase -s 4 -d 3
214 abort: source is descendant of destination
215 [255]
74
216
75 echo '% These will fail (using --source)'
217 D onto E - rebase onto a descendant:
76 createrepo > /dev/null 2>&1
218
77 echo '% E onto D - rebase onto an ancestor'
219 $ hg rebase -s 3 -d 4
78 hg rebase -s 4 -d 3
220 abort: source is ancestor of destination
79 echo '% D onto E - rebase onto a descendant'
221 [255]
80 hg rebase -s 3 -d 4
222
81 echo '% E onto B - merge revision with both parents not in ancestors of target'
223 E onto B - merge revision with both parents not in ancestors of target:
82 hg rebase -s 4 -d 1
224
225 $ hg rebase -s 4 -d 1
226 abort: cannot use revision 4 as base, result would have 3 parents
227 [255]
228
229
230 These will abort gracefully (using --base):
231
232 E onto E - rebase onto same changeset:
83
233
84 echo
234 $ hg rebase -b 4 -d 4
85 echo '% These will abort gracefully (using --base)'
235 nothing to rebase
86 echo '% E onto E - rebase onto same changeset'
236 [1]
87 hg rebase -b 4 -d 4
237
88 echo '% E onto D - rebase onto an ancestor'
238 E onto D - rebase onto an ancestor:
89 hg rebase -b 4 -d 3
90 echo '% D onto E - rebase onto a descendant'
91 hg rebase -b 3 -d 4
92
239
93 exit 0
240 $ hg rebase -b 4 -d 3
241 nothing to rebase
242 [1]
243
244 D onto E - rebase onto a descendant:
245
246 $ hg rebase -b 3 -d 4
247 nothing to rebase
248 [1]
249
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now