Show More
@@ -1,242 +1,336 b'' | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > rebase= |
|
3 | > rebase= | |
4 | > |
|
4 | > | |
5 | > [phases] |
|
5 | > [phases] | |
6 | > publish=False |
|
6 | > publish=False | |
7 | > |
|
7 | > | |
8 | > [alias] |
|
8 | > [alias] | |
9 | > tglog = log -G --template "{rev}: '{desc}' {branches}\n" |
|
9 | > tglog = log -G --template "{rev}: '{desc}' {branches}\n" | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | $ hg init a |
|
12 | $ hg init a | |
13 | $ cd a |
|
13 | $ cd a | |
14 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
14 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | |
15 | adding changesets |
|
15 | adding changesets | |
16 | adding manifests |
|
16 | adding manifests | |
17 | adding file changes |
|
17 | adding file changes | |
18 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
18 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
19 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
19 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
20 | $ hg up tip |
|
20 | $ hg up tip | |
21 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
21 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
22 | $ cd .. |
|
22 | $ cd .. | |
23 |
|
23 | |||
24 | $ hg clone -q -u . a a1 |
|
24 | $ hg clone -q -u . a a1 | |
25 |
|
25 | |||
26 | $ cd a1 |
|
26 | $ cd a1 | |
27 |
|
27 | |||
28 | $ hg update 3 |
|
28 | $ hg update 3 | |
29 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
29 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
30 | $ hg branch dev-one |
|
30 | $ hg branch dev-one | |
31 | marked working directory as branch dev-one |
|
31 | marked working directory as branch dev-one | |
32 | (branches are permanent and global, did you want a bookmark?) |
|
32 | (branches are permanent and global, did you want a bookmark?) | |
33 | $ hg ci -m 'dev-one named branch' |
|
33 | $ hg ci -m 'dev-one named branch' | |
34 |
|
34 | |||
35 | $ hg update 7 |
|
35 | $ hg update 7 | |
36 | 2 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
36 | 2 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
37 | $ hg branch dev-two |
|
37 | $ hg branch dev-two | |
38 | marked working directory as branch dev-two |
|
38 | marked working directory as branch dev-two | |
39 | (branches are permanent and global, did you want a bookmark?) |
|
39 | (branches are permanent and global, did you want a bookmark?) | |
40 |
|
40 | |||
41 | $ echo x > x |
|
41 | $ echo x > x | |
42 |
|
42 | |||
43 | $ hg add x |
|
43 | $ hg add x | |
44 |
|
44 | |||
45 | $ hg ci -m 'dev-two named branch' |
|
45 | $ hg ci -m 'dev-two named branch' | |
46 |
|
46 | |||
47 | $ hg tglog |
|
47 | $ hg tglog | |
48 | @ 9: 'dev-two named branch' dev-two |
|
48 | @ 9: 'dev-two named branch' dev-two | |
49 | | |
|
49 | | | |
50 | | o 8: 'dev-one named branch' dev-one |
|
50 | | o 8: 'dev-one named branch' dev-one | |
51 | | | |
|
51 | | | | |
52 | o | 7: 'H' |
|
52 | o | 7: 'H' | |
53 | | | |
|
53 | | | | |
54 | +---o 6: 'G' |
|
54 | +---o 6: 'G' | |
55 | | | | |
|
55 | | | | | |
56 | o | | 5: 'F' |
|
56 | o | | 5: 'F' | |
57 | | | | |
|
57 | | | | | |
58 | +---o 4: 'E' |
|
58 | +---o 4: 'E' | |
59 | | | |
|
59 | | | | |
60 | | o 3: 'D' |
|
60 | | o 3: 'D' | |
61 | | | |
|
61 | | | | |
62 | | o 2: 'C' |
|
62 | | o 2: 'C' | |
63 | | | |
|
63 | | | | |
64 | | o 1: 'B' |
|
64 | | o 1: 'B' | |
65 | |/ |
|
65 | |/ | |
66 | o 0: 'A' |
|
66 | o 0: 'A' | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | Branch name containing a dash (issue3181) |
|
69 | Branch name containing a dash (issue3181) | |
70 |
|
70 | |||
71 | $ hg rebase -b dev-two -d dev-one --keepbranches |
|
71 | $ hg rebase -b dev-two -d dev-one --keepbranches | |
72 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
72 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
73 |
|
73 | |||
74 | $ hg tglog |
|
74 | $ hg tglog | |
75 | @ 9: 'dev-two named branch' dev-two |
|
75 | @ 9: 'dev-two named branch' dev-two | |
76 | | |
|
76 | | | |
77 | o 8: 'H' |
|
77 | o 8: 'H' | |
78 | | |
|
78 | | | |
79 | | o 7: 'G' |
|
79 | | o 7: 'G' | |
80 | |/| |
|
80 | |/| | |
81 | o | 6: 'F' |
|
81 | o | 6: 'F' | |
82 | | | |
|
82 | | | | |
83 | o | 5: 'dev-one named branch' dev-one |
|
83 | o | 5: 'dev-one named branch' dev-one | |
84 | | | |
|
84 | | | | |
85 | | o 4: 'E' |
|
85 | | o 4: 'E' | |
86 | | | |
|
86 | | | | |
87 | o | 3: 'D' |
|
87 | o | 3: 'D' | |
88 | | | |
|
88 | | | | |
89 | o | 2: 'C' |
|
89 | o | 2: 'C' | |
90 | | | |
|
90 | | | | |
91 | o | 1: 'B' |
|
91 | o | 1: 'B' | |
92 | |/ |
|
92 | |/ | |
93 | o 0: 'A' |
|
93 | o 0: 'A' | |
94 |
|
94 | |||
95 | $ hg rebase -s dev-one -d 0 --keepbranches |
|
95 | $ hg rebase -s dev-one -d 0 --keepbranches | |
96 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
96 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
97 |
|
97 | |||
98 | $ hg tglog |
|
98 | $ hg tglog | |
99 | @ 8: 'dev-two named branch' dev-two |
|
99 | @ 8: 'dev-two named branch' dev-two | |
100 | | |
|
100 | | | |
101 | o 7: 'H' |
|
101 | o 7: 'H' | |
102 | | |
|
102 | | | |
103 | | o 6: 'G' |
|
103 | | o 6: 'G' | |
104 | |/| |
|
104 | |/| | |
105 | o | 5: 'F' |
|
105 | o | 5: 'F' | |
106 | | | |
|
106 | | | | |
107 | | o 4: 'E' |
|
107 | | o 4: 'E' | |
108 | |/ |
|
108 | |/ | |
109 | | o 3: 'D' |
|
109 | | o 3: 'D' | |
110 | | | |
|
110 | | | | |
111 | | o 2: 'C' |
|
111 | | o 2: 'C' | |
112 | | | |
|
112 | | | | |
113 | | o 1: 'B' |
|
113 | | o 1: 'B' | |
114 | |/ |
|
114 | |/ | |
115 | o 0: 'A' |
|
115 | o 0: 'A' | |
116 |
|
116 | |||
117 | $ hg update 3 |
|
117 | $ hg update 3 | |
118 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
118 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
119 | $ hg branch dev-one |
|
119 | $ hg branch dev-one | |
120 | marked working directory as branch dev-one |
|
120 | marked working directory as branch dev-one | |
121 | (branches are permanent and global, did you want a bookmark?) |
|
121 | (branches are permanent and global, did you want a bookmark?) | |
122 | $ hg ci -m 'dev-one named branch' |
|
122 | $ hg ci -m 'dev-one named branch' | |
123 |
|
123 | |||
124 | $ hg tglog |
|
124 | $ hg tglog | |
125 | @ 9: 'dev-one named branch' dev-one |
|
125 | @ 9: 'dev-one named branch' dev-one | |
126 | | |
|
126 | | | |
127 | | o 8: 'dev-two named branch' dev-two |
|
127 | | o 8: 'dev-two named branch' dev-two | |
128 | | | |
|
128 | | | | |
129 | | o 7: 'H' |
|
129 | | o 7: 'H' | |
130 | | | |
|
130 | | | | |
131 | | | o 6: 'G' |
|
131 | | | o 6: 'G' | |
132 | | |/| |
|
132 | | |/| | |
133 | | o | 5: 'F' |
|
133 | | o | 5: 'F' | |
134 | | | | |
|
134 | | | | | |
135 | | | o 4: 'E' |
|
135 | | | o 4: 'E' | |
136 | | |/ |
|
136 | | |/ | |
137 | o | 3: 'D' |
|
137 | o | 3: 'D' | |
138 | | | |
|
138 | | | | |
139 | o | 2: 'C' |
|
139 | o | 2: 'C' | |
140 | | | |
|
140 | | | | |
141 | o | 1: 'B' |
|
141 | o | 1: 'B' | |
142 | |/ |
|
142 | |/ | |
143 | o 0: 'A' |
|
143 | o 0: 'A' | |
144 |
|
144 | |||
145 | $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches |
|
145 | $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches | |
146 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
146 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
147 |
|
147 | |||
148 | $ hg tglog |
|
148 | $ hg tglog | |
149 | o 9: 'dev-two named branch' dev-two |
|
149 | o 9: 'dev-two named branch' dev-two | |
150 | | |
|
150 | | | |
151 | o 8: 'H' |
|
151 | o 8: 'H' | |
152 | | |
|
152 | | | |
153 | | o 7: 'G' |
|
153 | | o 7: 'G' | |
154 | |/| |
|
154 | |/| | |
155 | o | 6: 'F' |
|
155 | o | 6: 'F' | |
156 | | | |
|
156 | | | | |
157 | @ | 5: 'dev-one named branch' dev-one |
|
157 | @ | 5: 'dev-one named branch' dev-one | |
158 | | | |
|
158 | | | | |
159 | | o 4: 'E' |
|
159 | | o 4: 'E' | |
160 | | | |
|
160 | | | | |
161 | o | 3: 'D' |
|
161 | o | 3: 'D' | |
162 | | | |
|
162 | | | | |
163 | o | 2: 'C' |
|
163 | o | 2: 'C' | |
164 | | | |
|
164 | | | | |
165 | o | 1: 'B' |
|
165 | o | 1: 'B' | |
166 | |/ |
|
166 | |/ | |
167 | o 0: 'A' |
|
167 | o 0: 'A' | |
168 |
|
168 | |||
169 | $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches |
|
169 | $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches | |
170 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
170 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
171 |
|
171 | |||
172 | $ hg tglog |
|
172 | $ hg tglog | |
173 | o 8: 'dev-two named branch' dev-two |
|
173 | o 8: 'dev-two named branch' dev-two | |
174 | | |
|
174 | | | |
175 | o 7: 'H' |
|
175 | o 7: 'H' | |
176 | | |
|
176 | | | |
177 | | o 6: 'G' |
|
177 | | o 6: 'G' | |
178 | |/| |
|
178 | |/| | |
179 | o | 5: 'F' |
|
179 | o | 5: 'F' | |
180 | | | |
|
180 | | | | |
181 | | o 4: 'E' |
|
181 | | o 4: 'E' | |
182 | |/ |
|
182 | |/ | |
183 | | o 3: 'D' |
|
183 | | o 3: 'D' | |
184 | | | |
|
184 | | | | |
185 | | o 2: 'C' |
|
185 | | o 2: 'C' | |
186 | | | |
|
186 | | | | |
187 | | o 1: 'B' |
|
187 | | o 1: 'B' | |
188 | |/ |
|
188 | |/ | |
189 | @ 0: 'A' |
|
189 | @ 0: 'A' | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | Rebasing descendant onto ancestor across different named branches |
|
192 | Rebasing descendant onto ancestor across different named branches | |
193 |
|
193 | |||
194 | $ hg rebase -s 1 -d 8 --keepbranches |
|
194 | $ hg rebase -s 1 -d 8 --keepbranches | |
195 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
195 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
196 |
|
196 | |||
197 | $ hg tglog |
|
197 | $ hg tglog | |
198 | o 8: 'D' |
|
198 | o 8: 'D' | |
199 | | |
|
199 | | | |
200 | o 7: 'C' |
|
200 | o 7: 'C' | |
201 | | |
|
201 | | | |
202 | o 6: 'B' |
|
202 | o 6: 'B' | |
203 | | |
|
203 | | | |
204 | o 5: 'dev-two named branch' dev-two |
|
204 | o 5: 'dev-two named branch' dev-two | |
205 | | |
|
205 | | | |
206 | o 4: 'H' |
|
206 | o 4: 'H' | |
207 | | |
|
207 | | | |
208 | | o 3: 'G' |
|
208 | | o 3: 'G' | |
209 | |/| |
|
209 | |/| | |
210 | o | 2: 'F' |
|
210 | o | 2: 'F' | |
211 | | | |
|
211 | | | | |
212 | | o 1: 'E' |
|
212 | | o 1: 'E' | |
213 | |/ |
|
213 | |/ | |
214 | @ 0: 'A' |
|
214 | @ 0: 'A' | |
215 |
|
215 | |||
216 | $ hg rebase -s 4 -d 5 |
|
216 | $ hg rebase -s 4 -d 5 | |
217 | abort: source is ancestor of destination |
|
217 | abort: source is ancestor of destination | |
218 | [255] |
|
218 | [255] | |
219 |
|
219 | |||
220 | $ hg rebase -s 5 -d 4 |
|
220 | $ hg rebase -s 5 -d 4 | |
221 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
221 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | |
222 |
|
222 | |||
223 | $ hg tglog |
|
223 | $ hg tglog | |
224 | o 8: 'D' |
|
224 | o 8: 'D' | |
225 | | |
|
225 | | | |
226 | o 7: 'C' |
|
226 | o 7: 'C' | |
227 | | |
|
227 | | | |
228 | o 6: 'B' |
|
228 | o 6: 'B' | |
229 | | |
|
229 | | | |
230 | o 5: 'dev-two named branch' |
|
230 | o 5: 'dev-two named branch' | |
231 | | |
|
231 | | | |
232 | o 4: 'H' |
|
232 | o 4: 'H' | |
233 | | |
|
233 | | | |
234 | | o 3: 'G' |
|
234 | | o 3: 'G' | |
235 | |/| |
|
235 | |/| | |
236 | o | 2: 'F' |
|
236 | o | 2: 'F' | |
237 | | | |
|
237 | | | | |
238 | | o 1: 'E' |
|
238 | | o 1: 'E' | |
239 | |/ |
|
239 | |/ | |
240 | @ 0: 'A' |
|
240 | @ 0: 'A' | |
241 |
|
241 | |||
242 | $ cd .. |
|
242 | $ cd .. | |
|
243 | ||||
|
244 | Rebase to other head on branch | |||
|
245 | ||||
|
246 | Set up a case: | |||
|
247 | ||||
|
248 | $ hg init case1 | |||
|
249 | $ cd case1 | |||
|
250 | $ touch f | |||
|
251 | $ hg ci -qAm0 | |||
|
252 | $ hg branch -q b | |||
|
253 | $ echo >> f | |||
|
254 | $ hg ci -qAm 'b1' | |||
|
255 | $ hg up -qr -2 | |||
|
256 | $ hg branch -qf b | |||
|
257 | $ hg ci -qm 'b2' | |||
|
258 | $ hg up -qr -3 | |||
|
259 | $ hg branch -q c | |||
|
260 | $ hg ci -m 'c1' | |||
|
261 | ||||
|
262 | $ hg tglog | |||
|
263 | @ 3: 'c1' c | |||
|
264 | | | |||
|
265 | | o 2: 'b2' b | |||
|
266 | |/ | |||
|
267 | | o 1: 'b1' b | |||
|
268 | |/ | |||
|
269 | o 0: '0' | |||
|
270 | ||||
|
271 | $ hg clone -q . ../case2 | |||
|
272 | ||||
|
273 | rebase 'b2' to another lower branch head | |||
|
274 | ||||
|
275 | $ hg up -qr 2 | |||
|
276 | $ hg rebase | |||
|
277 | nothing to rebase - working directory parent is also destination | |||
|
278 | [1] | |||
|
279 | $ hg tglog | |||
|
280 | o 3: 'c1' c | |||
|
281 | | | |||
|
282 | | @ 2: 'b2' b | |||
|
283 | |/ | |||
|
284 | | o 1: 'b1' b | |||
|
285 | |/ | |||
|
286 | o 0: '0' | |||
|
287 | ||||
|
288 | ||||
|
289 | rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1') | |||
|
290 | ||||
|
291 | $ cd ../case2 | |||
|
292 | $ hg up -qr 1 | |||
|
293 | $ hg rebase | |||
|
294 | saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-backup.hg (glob) | |||
|
295 | $ hg tglog | |||
|
296 | @ 3: 'b1' b | |||
|
297 | | | |||
|
298 | | o 2: 'c1' c | |||
|
299 | | | | |||
|
300 | o | 1: 'b2' b | |||
|
301 | |/ | |||
|
302 | o 0: '0' | |||
|
303 | ||||
|
304 | ||||
|
305 | rebase 'c1' to the branch head 'c2' that is closed | |||
|
306 | ||||
|
307 | $ hg branch -qf c | |||
|
308 | $ hg ci -qm 'c2 closed' --close | |||
|
309 | $ hg up -qr 2 | |||
|
310 | $ hg tglog | |||
|
311 | o 4: 'c2 closed' c | |||
|
312 | | | |||
|
313 | o 3: 'b1' b | |||
|
314 | | | |||
|
315 | | @ 2: 'c1' c | |||
|
316 | | | | |||
|
317 | o | 1: 'b2' b | |||
|
318 | |/ | |||
|
319 | o 0: '0' | |||
|
320 | ||||
|
321 | $ hg rebase | |||
|
322 | nothing to rebase - working directory parent is also destination | |||
|
323 | [1] | |||
|
324 | $ hg tglog | |||
|
325 | o 4: 'c2 closed' c | |||
|
326 | | | |||
|
327 | o 3: 'b1' b | |||
|
328 | | | |||
|
329 | | @ 2: 'c1' c | |||
|
330 | | | | |||
|
331 | o | 1: 'b2' b | |||
|
332 | |/ | |||
|
333 | o 0: '0' | |||
|
334 | ||||
|
335 | ||||
|
336 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now