Show More
@@ -1,242 +1,336 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [extensions] |
|
3 | 3 | > rebase= |
|
4 | 4 | > |
|
5 | 5 | > [phases] |
|
6 | 6 | > publish=False |
|
7 | 7 | > |
|
8 | 8 | > [alias] |
|
9 | 9 | > tglog = log -G --template "{rev}: '{desc}' {branches}\n" |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | $ hg init a |
|
13 | 13 | $ cd a |
|
14 | 14 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
15 | 15 | adding changesets |
|
16 | 16 | adding manifests |
|
17 | 17 | adding file changes |
|
18 | 18 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
19 | 19 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
20 | 20 | $ hg up tip |
|
21 | 21 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 22 | $ cd .. |
|
23 | 23 | |
|
24 | 24 | $ hg clone -q -u . a a1 |
|
25 | 25 | |
|
26 | 26 | $ cd a1 |
|
27 | 27 | |
|
28 | 28 | $ hg update 3 |
|
29 | 29 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
30 | 30 | $ hg branch dev-one |
|
31 | 31 | marked working directory as branch dev-one |
|
32 | 32 | (branches are permanent and global, did you want a bookmark?) |
|
33 | 33 | $ hg ci -m 'dev-one named branch' |
|
34 | 34 | |
|
35 | 35 | $ hg update 7 |
|
36 | 36 | 2 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
37 | 37 | $ hg branch dev-two |
|
38 | 38 | marked working directory as branch dev-two |
|
39 | 39 | (branches are permanent and global, did you want a bookmark?) |
|
40 | 40 | |
|
41 | 41 | $ echo x > x |
|
42 | 42 | |
|
43 | 43 | $ hg add x |
|
44 | 44 | |
|
45 | 45 | $ hg ci -m 'dev-two named branch' |
|
46 | 46 | |
|
47 | 47 | $ hg tglog |
|
48 | 48 | @ 9: 'dev-two named branch' dev-two |
|
49 | 49 | | |
|
50 | 50 | | o 8: 'dev-one named branch' dev-one |
|
51 | 51 | | | |
|
52 | 52 | o | 7: 'H' |
|
53 | 53 | | | |
|
54 | 54 | +---o 6: 'G' |
|
55 | 55 | | | | |
|
56 | 56 | o | | 5: 'F' |
|
57 | 57 | | | | |
|
58 | 58 | +---o 4: 'E' |
|
59 | 59 | | | |
|
60 | 60 | | o 3: 'D' |
|
61 | 61 | | | |
|
62 | 62 | | o 2: 'C' |
|
63 | 63 | | | |
|
64 | 64 | | o 1: 'B' |
|
65 | 65 | |/ |
|
66 | 66 | o 0: 'A' |
|
67 | 67 | |
|
68 | 68 | |
|
69 | 69 | Branch name containing a dash (issue3181) |
|
70 | 70 | |
|
71 | 71 | $ hg rebase -b dev-two -d dev-one --keepbranches |
|
72 | 72 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
73 | 73 | |
|
74 | 74 | $ hg tglog |
|
75 | 75 | @ 9: 'dev-two named branch' dev-two |
|
76 | 76 | | |
|
77 | 77 | o 8: 'H' |
|
78 | 78 | | |
|
79 | 79 | | o 7: 'G' |
|
80 | 80 | |/| |
|
81 | 81 | o | 6: 'F' |
|
82 | 82 | | | |
|
83 | 83 | o | 5: 'dev-one named branch' dev-one |
|
84 | 84 | | | |
|
85 | 85 | | o 4: 'E' |
|
86 | 86 | | | |
|
87 | 87 | o | 3: 'D' |
|
88 | 88 | | | |
|
89 | 89 | o | 2: 'C' |
|
90 | 90 | | | |
|
91 | 91 | o | 1: 'B' |
|
92 | 92 | |/ |
|
93 | 93 | o 0: 'A' |
|
94 | 94 | |
|
95 | 95 | $ hg rebase -s dev-one -d 0 --keepbranches |
|
96 | 96 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
97 | 97 | |
|
98 | 98 | $ hg tglog |
|
99 | 99 | @ 8: 'dev-two named branch' dev-two |
|
100 | 100 | | |
|
101 | 101 | o 7: 'H' |
|
102 | 102 | | |
|
103 | 103 | | o 6: 'G' |
|
104 | 104 | |/| |
|
105 | 105 | o | 5: 'F' |
|
106 | 106 | | | |
|
107 | 107 | | o 4: 'E' |
|
108 | 108 | |/ |
|
109 | 109 | | o 3: 'D' |
|
110 | 110 | | | |
|
111 | 111 | | o 2: 'C' |
|
112 | 112 | | | |
|
113 | 113 | | o 1: 'B' |
|
114 | 114 | |/ |
|
115 | 115 | o 0: 'A' |
|
116 | 116 | |
|
117 | 117 | $ hg update 3 |
|
118 | 118 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
119 | 119 | $ hg branch dev-one |
|
120 | 120 | marked working directory as branch dev-one |
|
121 | 121 | (branches are permanent and global, did you want a bookmark?) |
|
122 | 122 | $ hg ci -m 'dev-one named branch' |
|
123 | 123 | |
|
124 | 124 | $ hg tglog |
|
125 | 125 | @ 9: 'dev-one named branch' dev-one |
|
126 | 126 | | |
|
127 | 127 | | o 8: 'dev-two named branch' dev-two |
|
128 | 128 | | | |
|
129 | 129 | | o 7: 'H' |
|
130 | 130 | | | |
|
131 | 131 | | | o 6: 'G' |
|
132 | 132 | | |/| |
|
133 | 133 | | o | 5: 'F' |
|
134 | 134 | | | | |
|
135 | 135 | | | o 4: 'E' |
|
136 | 136 | | |/ |
|
137 | 137 | o | 3: 'D' |
|
138 | 138 | | | |
|
139 | 139 | o | 2: 'C' |
|
140 | 140 | | | |
|
141 | 141 | o | 1: 'B' |
|
142 | 142 | |/ |
|
143 | 143 | o 0: 'A' |
|
144 | 144 | |
|
145 | 145 | $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches |
|
146 | 146 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
147 | 147 | |
|
148 | 148 | $ hg tglog |
|
149 | 149 | o 9: 'dev-two named branch' dev-two |
|
150 | 150 | | |
|
151 | 151 | o 8: 'H' |
|
152 | 152 | | |
|
153 | 153 | | o 7: 'G' |
|
154 | 154 | |/| |
|
155 | 155 | o | 6: 'F' |
|
156 | 156 | | | |
|
157 | 157 | @ | 5: 'dev-one named branch' dev-one |
|
158 | 158 | | | |
|
159 | 159 | | o 4: 'E' |
|
160 | 160 | | | |
|
161 | 161 | o | 3: 'D' |
|
162 | 162 | | | |
|
163 | 163 | o | 2: 'C' |
|
164 | 164 | | | |
|
165 | 165 | o | 1: 'B' |
|
166 | 166 | |/ |
|
167 | 167 | o 0: 'A' |
|
168 | 168 | |
|
169 | 169 | $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches |
|
170 | 170 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
171 | 171 | |
|
172 | 172 | $ hg tglog |
|
173 | 173 | o 8: 'dev-two named branch' dev-two |
|
174 | 174 | | |
|
175 | 175 | o 7: 'H' |
|
176 | 176 | | |
|
177 | 177 | | o 6: 'G' |
|
178 | 178 | |/| |
|
179 | 179 | o | 5: 'F' |
|
180 | 180 | | | |
|
181 | 181 | | o 4: 'E' |
|
182 | 182 | |/ |
|
183 | 183 | | o 3: 'D' |
|
184 | 184 | | | |
|
185 | 185 | | o 2: 'C' |
|
186 | 186 | | | |
|
187 | 187 | | o 1: 'B' |
|
188 | 188 | |/ |
|
189 | 189 | @ 0: 'A' |
|
190 | 190 | |
|
191 | 191 | |
|
192 | 192 | Rebasing descendant onto ancestor across different named branches |
|
193 | 193 | |
|
194 | 194 | $ hg rebase -s 1 -d 8 --keepbranches |
|
195 | 195 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
196 | 196 | |
|
197 | 197 | $ hg tglog |
|
198 | 198 | o 8: 'D' |
|
199 | 199 | | |
|
200 | 200 | o 7: 'C' |
|
201 | 201 | | |
|
202 | 202 | o 6: 'B' |
|
203 | 203 | | |
|
204 | 204 | o 5: 'dev-two named branch' dev-two |
|
205 | 205 | | |
|
206 | 206 | o 4: 'H' |
|
207 | 207 | | |
|
208 | 208 | | o 3: 'G' |
|
209 | 209 | |/| |
|
210 | 210 | o | 2: 'F' |
|
211 | 211 | | | |
|
212 | 212 | | o 1: 'E' |
|
213 | 213 | |/ |
|
214 | 214 | @ 0: 'A' |
|
215 | 215 | |
|
216 | 216 | $ hg rebase -s 4 -d 5 |
|
217 | 217 | abort: source is ancestor of destination |
|
218 | 218 | [255] |
|
219 | 219 | |
|
220 | 220 | $ hg rebase -s 5 -d 4 |
|
221 | 221 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) |
|
222 | 222 | |
|
223 | 223 | $ hg tglog |
|
224 | 224 | o 8: 'D' |
|
225 | 225 | | |
|
226 | 226 | o 7: 'C' |
|
227 | 227 | | |
|
228 | 228 | o 6: 'B' |
|
229 | 229 | | |
|
230 | 230 | o 5: 'dev-two named branch' |
|
231 | 231 | | |
|
232 | 232 | o 4: 'H' |
|
233 | 233 | | |
|
234 | 234 | | o 3: 'G' |
|
235 | 235 | |/| |
|
236 | 236 | o | 2: 'F' |
|
237 | 237 | | | |
|
238 | 238 | | o 1: 'E' |
|
239 | 239 | |/ |
|
240 | 240 | @ 0: 'A' |
|
241 | 241 | |
|
242 | 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