Show More
@@ -1,392 +1,394 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}:{phase} '{desc}' {branches}\n" |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | |
|
13 | 13 | $ hg init a |
|
14 | 14 | $ cd a |
|
15 | 15 | |
|
16 | 16 | $ touch .hg/rebasestate |
|
17 | 17 | $ hg sum |
|
18 | 18 | parent: -1:000000000000 tip (empty repository) |
|
19 | 19 | branch: default |
|
20 | 20 | commit: (clean) |
|
21 | 21 | update: (current) |
|
22 | 22 | abort: .hg/rebasestate is incomplete |
|
23 | 23 | [255] |
|
24 | 24 | $ rm .hg/rebasestate |
|
25 | 25 | |
|
26 | 26 | $ echo c1 > common |
|
27 | 27 | $ hg add common |
|
28 | 28 | $ hg ci -m C1 |
|
29 | 29 | |
|
30 | 30 | $ echo c2 >> common |
|
31 | 31 | $ hg ci -m C2 |
|
32 | 32 | |
|
33 | 33 | $ echo c3 >> common |
|
34 | 34 | $ hg ci -m C3 |
|
35 | 35 | |
|
36 | 36 | $ hg up -q -C 1 |
|
37 | 37 | |
|
38 | 38 | $ echo l1 >> extra |
|
39 | 39 | $ hg add extra |
|
40 | 40 | $ hg ci -m L1 |
|
41 | 41 | created new head |
|
42 | 42 | |
|
43 | 43 | $ sed -e 's/c2/l2/' common > common.new |
|
44 | 44 | $ mv common.new common |
|
45 | 45 | $ hg ci -m L2 |
|
46 | 46 | |
|
47 | 47 | $ hg phase --force --secret 2 |
|
48 | 48 | |
|
49 | 49 | $ hg tglog |
|
50 | 50 | @ 4:draft 'L2' |
|
51 | 51 | | |
|
52 | 52 | o 3:draft 'L1' |
|
53 | 53 | | |
|
54 | 54 | | o 2:secret 'C3' |
|
55 | 55 | |/ |
|
56 | 56 | o 1:draft 'C2' |
|
57 | 57 | | |
|
58 | 58 | o 0:draft 'C1' |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | Conflicting rebase: |
|
62 | 62 | |
|
63 | 63 | $ hg rebase -s 3 -d 2 |
|
64 | 64 | rebasing 3:3163e20567cc "L1" |
|
65 | 65 | rebasing 4:46f0b057b5c0 "L2" (tip) |
|
66 | 66 | merging common |
|
67 | 67 | warning: conflicts while merging common! (edit, then use 'hg resolve --mark') |
|
68 | 68 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
69 | 69 | [1] |
|
70 | 70 | |
|
71 | 71 | Insert unsupported advisory merge record: |
|
72 | 72 | |
|
73 | 73 | $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x |
|
74 | 74 | $ hg debugmergestate |
|
75 | 75 | * version 2 records |
|
76 | 76 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc |
|
77 | 77 | other: 46f0b057b5c061d276b91491c22151f78698abd2 |
|
78 | 78 | unrecognized entry: x advisory record |
|
79 | 79 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) |
|
80 | 80 | local path: common (flags "") |
|
81 | 81 | ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6) |
|
82 | 82 | other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5) |
|
83 | 83 | $ hg resolve -l |
|
84 | 84 | U common |
|
85 | 85 | |
|
86 | 86 | Insert unsupported mandatory merge record: |
|
87 | 87 | |
|
88 | 88 | $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X |
|
89 | 89 | $ hg debugmergestate |
|
90 | 90 | * version 2 records |
|
91 | 91 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc |
|
92 | 92 | other: 46f0b057b5c061d276b91491c22151f78698abd2 |
|
93 | 93 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) |
|
94 | 94 | local path: common (flags "") |
|
95 | 95 | ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6) |
|
96 | 96 | other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5) |
|
97 | 97 | unrecognized entry: X mandatory record |
|
98 | 98 | $ hg resolve -l |
|
99 | 99 | abort: unsupported merge state records: X |
|
100 | 100 | (see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
|
101 | 101 | [255] |
|
102 | 102 | $ hg resolve -ma |
|
103 | 103 | abort: unsupported merge state records: X |
|
104 | 104 | (see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
|
105 | 105 | [255] |
|
106 | 106 | |
|
107 | 107 | Abort (should clear out unsupported merge state): |
|
108 | 108 | |
|
109 | 109 | $ hg rebase --abort |
|
110 | 110 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg (glob) |
|
111 | 111 | rebase aborted |
|
112 | 112 | $ hg debugmergestate |
|
113 | 113 | no merge state found |
|
114 | 114 | |
|
115 | 115 | $ hg tglog |
|
116 | 116 | @ 4:draft 'L2' |
|
117 | 117 | | |
|
118 | 118 | o 3:draft 'L1' |
|
119 | 119 | | |
|
120 | 120 | | o 2:secret 'C3' |
|
121 | 121 | |/ |
|
122 | 122 | o 1:draft 'C2' |
|
123 | 123 | | |
|
124 | 124 | o 0:draft 'C1' |
|
125 | 125 | |
|
126 | 126 | Test safety for inconsistent rebase state, which may be created (and |
|
127 | 127 | forgotten) by Mercurial earlier than 2.7. This emulates Mercurial |
|
128 | 128 | earlier than 2.7 by renaming ".hg/rebasestate" temporarily. |
|
129 | 129 | |
|
130 | 130 | $ hg rebase -s 3 -d 2 |
|
131 | 131 | rebasing 3:3163e20567cc "L1" |
|
132 | 132 | rebasing 4:46f0b057b5c0 "L2" (tip) |
|
133 | 133 | merging common |
|
134 | 134 | warning: conflicts while merging common! (edit, then use 'hg resolve --mark') |
|
135 | 135 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
136 | 136 | [1] |
|
137 | 137 | |
|
138 | 138 | $ mv .hg/rebasestate .hg/rebasestate.back |
|
139 | 139 | $ hg update --quiet --clean 2 |
|
140 | 140 | $ hg --config extensions.mq= strip --quiet "destination()" |
|
141 | 141 | $ mv .hg/rebasestate.back .hg/rebasestate |
|
142 | 142 | |
|
143 | 143 | $ hg rebase --continue |
|
144 | 144 | abort: cannot continue inconsistent rebase |
|
145 | 145 | (use "hg rebase --abort" to clear broken state) |
|
146 | 146 | [255] |
|
147 | 147 | $ hg summary | grep '^rebase: ' |
|
148 | 148 | rebase: (use "hg rebase --abort" to clear broken state) |
|
149 | 149 | $ hg rebase --abort |
|
150 | 150 | rebase aborted (no revision is removed, only broken state is cleared) |
|
151 | 151 | |
|
152 | 152 | $ cd .. |
|
153 | 153 | |
|
154 | 154 | |
|
155 | 155 | Construct new repo: |
|
156 | 156 | |
|
157 | 157 | $ hg init b |
|
158 | 158 | $ cd b |
|
159 | 159 | |
|
160 | 160 | $ echo a > a |
|
161 | 161 | $ hg ci -Am A |
|
162 | 162 | adding a |
|
163 | 163 | |
|
164 | 164 | $ echo b > b |
|
165 | 165 | $ hg ci -Am B |
|
166 | 166 | adding b |
|
167 | 167 | |
|
168 | 168 | $ echo c > c |
|
169 | 169 | $ hg ci -Am C |
|
170 | 170 | adding c |
|
171 | 171 | |
|
172 | 172 | $ hg up -q 0 |
|
173 | 173 | |
|
174 | 174 | $ echo b > b |
|
175 | 175 | $ hg ci -Am 'B bis' |
|
176 | 176 | adding b |
|
177 | 177 | created new head |
|
178 | 178 | |
|
179 | 179 | $ echo c1 > c |
|
180 | 180 | $ hg ci -Am C1 |
|
181 | 181 | adding c |
|
182 | 182 | |
|
183 | 183 | $ hg phase --force --secret 1 |
|
184 | 184 | $ hg phase --public 1 |
|
185 | 185 | |
|
186 | 186 | Rebase and abort without generating new changesets: |
|
187 | 187 | |
|
188 | 188 | $ hg tglog |
|
189 | 189 | @ 4:draft 'C1' |
|
190 | 190 | | |
|
191 | 191 | o 3:draft 'B bis' |
|
192 | 192 | | |
|
193 | 193 | | o 2:secret 'C' |
|
194 | 194 | | | |
|
195 | 195 | | o 1:public 'B' |
|
196 | 196 | |/ |
|
197 | 197 | o 0:public 'A' |
|
198 | 198 | |
|
199 | 199 | $ hg rebase -b 4 -d 2 |
|
200 | 200 | rebasing 3:a6484957d6b9 "B bis" |
|
201 | 201 | note: rebase of 3:a6484957d6b9 created no changes to commit |
|
202 | 202 | rebasing 4:145842775fec "C1" (tip) |
|
203 | 203 | merging c |
|
204 | 204 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
205 | 205 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
206 | 206 | [1] |
|
207 | 207 | |
|
208 | 208 | $ hg tglog |
|
209 | 209 | @ 4:draft 'C1' |
|
210 | 210 | | |
|
211 | 211 | o 3:draft 'B bis' |
|
212 | 212 | | |
|
213 | 213 | | @ 2:secret 'C' |
|
214 | 214 | | | |
|
215 | 215 | | o 1:public 'B' |
|
216 | 216 | |/ |
|
217 | 217 | o 0:public 'A' |
|
218 | 218 | |
|
219 | 219 | $ hg rebase -a |
|
220 | 220 | rebase aborted |
|
221 | 221 | |
|
222 | 222 | $ hg tglog |
|
223 | 223 | @ 4:draft 'C1' |
|
224 | 224 | | |
|
225 | 225 | o 3:draft 'B bis' |
|
226 | 226 | | |
|
227 | 227 | | o 2:secret 'C' |
|
228 | 228 | | | |
|
229 | 229 | | o 1:public 'B' |
|
230 | 230 | |/ |
|
231 | 231 | o 0:public 'A' |
|
232 | 232 | |
|
233 | 233 | |
|
234 | 234 | $ cd .. |
|
235 | 235 | |
|
236 | 236 | rebase abort should not leave working copy in a merge state if tip-1 is public |
|
237 | 237 | (issue4082) |
|
238 | 238 | |
|
239 | 239 | $ hg init abortpublic |
|
240 | 240 | $ cd abortpublic |
|
241 | 241 | $ echo a > a && hg ci -Aqm a |
|
242 | 242 | $ hg book master |
|
243 | 243 | $ hg book foo |
|
244 | 244 | $ echo b > b && hg ci -Aqm b |
|
245 | 245 | $ hg up -q master |
|
246 | 246 | $ echo c > c && hg ci -Aqm c |
|
247 | 247 | $ hg phase -p -r . |
|
248 | 248 | $ hg up -q foo |
|
249 | 249 | $ echo C > c && hg ci -Aqm C |
|
250 | 250 | $ hg log -G --template "{rev} {desc} {bookmarks}" |
|
251 | 251 | @ 3 C foo |
|
252 | 252 | | |
|
253 | 253 | | o 2 c master |
|
254 | 254 | | | |
|
255 | 255 | o | 1 b |
|
256 | 256 | |/ |
|
257 | 257 | o 0 a |
|
258 | 258 | |
|
259 | 259 | |
|
260 | 260 | $ hg rebase -d master -r foo |
|
261 | 261 | rebasing 3:6c0f977a22d8 "C" (tip foo) |
|
262 | 262 | merging c |
|
263 | 263 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
264 | 264 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
265 | 265 | [1] |
|
266 | 266 | $ hg rebase --abort |
|
267 | 267 | rebase aborted |
|
268 | 268 | $ hg log -G --template "{rev} {desc} {bookmarks}" |
|
269 | 269 | @ 3 C foo |
|
270 | 270 | | |
|
271 | 271 | | o 2 c master |
|
272 | 272 | | | |
|
273 | 273 | o | 1 b |
|
274 | 274 | |/ |
|
275 | 275 | o 0 a |
|
276 | 276 | |
|
277 | 277 | $ cd .. |
|
278 | 278 | |
|
279 | 279 | Make sure we don't clobber changes in the working directory when the |
|
280 | 280 | user has somehow managed to update to a different revision (issue4009) |
|
281 | 281 | |
|
282 | 282 | $ hg init noupdate |
|
283 | 283 | $ cd noupdate |
|
284 | 284 | $ hg book @ |
|
285 | 285 | $ echo original > a |
|
286 | 286 | $ hg add a |
|
287 | 287 | $ hg commit -m a |
|
288 | 288 | $ echo x > b |
|
289 | 289 | $ hg add b |
|
290 | 290 | $ hg commit -m b1 |
|
291 | 291 | $ hg up 0 |
|
292 | 292 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
293 | 293 | (leaving bookmark @) |
|
294 | 294 | $ hg book foo |
|
295 | 295 | $ echo y > b |
|
296 | 296 | $ hg add b |
|
297 | 297 | $ hg commit -m b2 |
|
298 | 298 | created new head |
|
299 | 299 | |
|
300 | 300 | $ hg rebase -d @ -b foo --tool=internal:fail |
|
301 | 301 | rebasing 2:070cf4580bb5 "b2" (tip foo) |
|
302 | 302 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
303 | 303 | [1] |
|
304 | 304 | |
|
305 | 305 | $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3 |
|
306 | 306 | $ hg up -C 0 # user does other stuff in the repo |
|
307 | 307 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
308 | 308 | |
|
309 | 309 | $ mv rebasestate .hg/ # user upgrades to 2.7 |
|
310 | 310 | |
|
311 | 311 | $ echo new > a |
|
312 | 312 | $ hg up 1 # user gets an error saying to run hg rebase --abort |
|
313 | 313 | abort: rebase in progress |
|
314 | 314 | (use 'hg rebase --continue' or 'hg rebase --abort') |
|
315 | 315 | [255] |
|
316 | 316 | |
|
317 | 317 | $ cat a |
|
318 | 318 | new |
|
319 | 319 | $ hg rebase --abort |
|
320 | 320 | rebase aborted |
|
321 | 321 | $ cat a |
|
322 | 322 | new |
|
323 | 323 | |
|
324 | 324 | $ cd .. |
|
325 | 325 | |
|
326 | 326 | On the other hand, make sure we *do* clobber changes whenever we |
|
327 | 327 | haven't somehow managed to update the repo to a different revision |
|
328 | 328 | during a rebase (issue4661) |
|
329 | 329 | |
|
330 | 330 | $ hg ini yesupdate |
|
331 | 331 | $ cd yesupdate |
|
332 | 332 | $ echo "initial data" > foo.txt |
|
333 | 333 | $ hg add |
|
334 | 334 | adding foo.txt |
|
335 | 335 | $ hg ci -m "initial checkin" |
|
336 | 336 | $ echo "change 1" > foo.txt |
|
337 | 337 | $ hg ci -m "change 1" |
|
338 | 338 | $ hg up 0 |
|
339 | 339 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
340 | 340 | $ echo "conflicting change 1" > foo.txt |
|
341 | 341 | $ hg ci -m "conflicting 1" |
|
342 | 342 | created new head |
|
343 | 343 | $ echo "conflicting change 2" > foo.txt |
|
344 | 344 | $ hg ci -m "conflicting 2" |
|
345 | 345 | |
|
346 | 346 | $ hg rebase -d 1 --tool 'internal:fail' |
|
347 | 347 | rebasing 2:e4ea5cdc9789 "conflicting 1" |
|
348 | 348 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
349 | 349 | [1] |
|
350 | 350 | $ hg rebase --abort |
|
351 | 351 | rebase aborted |
|
352 | 352 | $ hg summary |
|
353 | 353 | parent: 3:b16646383533 tip |
|
354 | 354 | conflicting 2 |
|
355 | 355 | branch: default |
|
356 | 356 | commit: (clean) |
|
357 | 357 | update: 1 new changesets, 2 branch heads (merge) |
|
358 | 358 | phases: 4 draft |
|
359 | $ cd .. | |
|
359 | 360 | |
|
360 | 361 | test aborting a rebase succeeds after rebasing with skipped commits onto a |
|
361 | 362 | public changeset (issue4896) |
|
362 | 363 | |
|
363 | 364 | $ hg init succeedonpublic |
|
364 | 365 | $ cd succeedonpublic |
|
365 | 366 | $ echo 'content' > root |
|
366 | 367 | $ hg commit -A -m 'root' -q |
|
367 | 368 | |
|
368 | 369 | set up public branch |
|
369 | 370 | $ echo 'content' > disappear |
|
370 | 371 | $ hg commit -A -m 'disappear public' -q |
|
371 | 372 | commit will cause merge conflict on rebase |
|
372 | 373 | $ echo '' > root |
|
373 | 374 | $ hg commit -m 'remove content public' -q |
|
374 | 375 | $ hg phase --public |
|
375 | 376 | |
|
376 | 377 | setup the draft branch that will be rebased onto public commit |
|
377 | 378 | $ hg up -r 0 -q |
|
378 | 379 | $ echo 'content' > disappear |
|
379 | 380 | commit will disappear |
|
380 | 381 | $ hg commit -A -m 'disappear draft' -q |
|
381 | 382 | $ echo 'addedcontADDEDentadded' > root |
|
382 | 383 | commit will cause merge conflict on rebase |
|
383 | 384 | $ hg commit -m 'add content draft' -q |
|
384 | 385 | |
|
385 | 386 | $ hg rebase -d 'public()' --tool :merge -q |
|
386 | 387 | note: rebase of 3:0682fd3dabf5 created no changes to commit |
|
387 | 388 | warning: conflicts while merging root! (edit, then use 'hg resolve --mark') |
|
388 | 389 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
389 | 390 | [1] |
|
390 | 391 | $ hg rebase --abort |
|
391 | 392 | rebase aborted |
|
393 | $ cd .. | |
|
392 | 394 |
General Comments 0
You need to be logged in to leave comments.
Login now