Show More
@@ -1,824 +1,826 b'' | |||
|
1 | 1 | $ hg init basic |
|
2 | 2 | $ cd basic |
|
3 | 3 | |
|
4 | 4 | should complain |
|
5 | 5 | |
|
6 | 6 | $ hg backout |
|
7 | 7 | abort: please specify a revision to backout |
|
8 | 8 | [10] |
|
9 | 9 | $ hg backout -r 0 0 |
|
10 | 10 | abort: please specify just one revision |
|
11 | 11 | [10] |
|
12 | 12 | |
|
13 | 13 | basic operation |
|
14 | 14 | (this also tests that editor is invoked if the commit message is not |
|
15 | 15 | specified explicitly) |
|
16 | 16 | |
|
17 | 17 | $ echo a > a |
|
18 | 18 | $ hg commit -d '0 0' -A -m a |
|
19 | 19 | adding a |
|
20 | 20 | $ echo b >> a |
|
21 | 21 | $ hg commit -d '1 0' -m b |
|
22 | 22 | |
|
23 | 23 | $ hg status --rev tip --rev "tip^1" |
|
24 | 24 | M a |
|
25 | 25 | $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true |
|
26 | 26 | reverting a |
|
27 | 27 | Backed out changeset a820f4f40a57 |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
31 | 31 | HG: Leave message empty to abort commit. |
|
32 | 32 | HG: -- |
|
33 | 33 | HG: user: test |
|
34 | 34 | HG: branch 'default' |
|
35 | 35 | HG: changed a |
|
36 | 36 | changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 |
|
37 | 37 | $ cat a |
|
38 | 38 | a |
|
39 | 39 | $ hg summary |
|
40 | 40 | parent: 2:2929462c3dff tip |
|
41 | 41 | Backed out changeset a820f4f40a57 |
|
42 | 42 | branch: default |
|
43 | 43 | commit: (clean) |
|
44 | 44 | update: (current) |
|
45 | 45 | phases: 3 draft |
|
46 | 46 | |
|
47 | 47 | commit option |
|
48 | 48 | |
|
49 | 49 | $ cd .. |
|
50 | 50 | $ hg init commit |
|
51 | 51 | $ cd commit |
|
52 | 52 | |
|
53 | 53 | $ echo tomatoes > a |
|
54 | 54 | $ hg add a |
|
55 | 55 | $ hg commit -d '0 0' -m tomatoes |
|
56 | 56 | |
|
57 | 57 | $ echo chair > b |
|
58 | 58 | $ hg add b |
|
59 | 59 | $ hg commit -d '1 0' -m chair |
|
60 | 60 | |
|
61 | 61 | $ echo grapes >> a |
|
62 | 62 | $ hg commit -d '2 0' -m grapes |
|
63 | 63 | |
|
64 | 64 | $ hg backout -d '4 0' 1 --tool=:fail |
|
65 | 65 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
66 | 66 | changeset 3:1c2161e97c0a backs out changeset 1:22cb4f70d813 |
|
67 | 67 | $ hg summary |
|
68 | 68 | parent: 3:1c2161e97c0a tip |
|
69 | 69 | Backed out changeset 22cb4f70d813 |
|
70 | 70 | branch: default |
|
71 | 71 | commit: (clean) |
|
72 | 72 | update: (current) |
|
73 | 73 | phases: 4 draft |
|
74 | 74 | |
|
75 | 75 | $ echo ypples > a |
|
76 | 76 | $ hg commit -d '5 0' -m ypples |
|
77 | 77 | |
|
78 | 78 | $ hg backout -d '6 0' 2 --tool=:fail |
|
79 | 79 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
80 | 80 | use 'hg resolve' to retry unresolved file merges |
|
81 | 81 | [1] |
|
82 | 82 | $ hg summary |
|
83 | 83 | parent: 4:ed99997b793d tip |
|
84 | 84 | ypples |
|
85 | 85 | branch: default |
|
86 | 86 | commit: 1 unresolved (clean) |
|
87 | 87 | update: (current) |
|
88 | 88 | phases: 5 draft |
|
89 | 89 | $ hg log -G |
|
90 | 90 | @ changeset: 4:ed99997b793d |
|
91 | 91 | | tag: tip |
|
92 | 92 | | user: test |
|
93 | 93 | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
94 | 94 | | summary: ypples |
|
95 | 95 | | |
|
96 | 96 | o changeset: 3:1c2161e97c0a |
|
97 | 97 | | user: test |
|
98 | 98 | | date: Thu Jan 01 00:00:04 1970 +0000 |
|
99 | 99 | | summary: Backed out changeset 22cb4f70d813 |
|
100 | 100 | | |
|
101 | 101 | o changeset: 2:a8c6e511cfee |
|
102 | 102 | | user: test |
|
103 | 103 | | date: Thu Jan 01 00:00:02 1970 +0000 |
|
104 | 104 | | summary: grapes |
|
105 | 105 | | |
|
106 | 106 | % changeset: 1:22cb4f70d813 |
|
107 | 107 | | user: test |
|
108 | 108 | | date: Thu Jan 01 00:00:01 1970 +0000 |
|
109 | 109 | | summary: chair |
|
110 | 110 | | |
|
111 | 111 | o changeset: 0:a5cb2dde5805 |
|
112 | 112 | user: test |
|
113 | 113 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
114 | 114 | summary: tomatoes |
|
115 | 115 | |
|
116 | 116 | |
|
117 | 117 | file that was removed is recreated |
|
118 | 118 | (this also tests that editor is not invoked if the commit message is |
|
119 | 119 | specified explicitly) |
|
120 | 120 | |
|
121 | 121 | $ cd .. |
|
122 | 122 | $ hg init remove |
|
123 | 123 | $ cd remove |
|
124 | 124 | |
|
125 | 125 | $ echo content > a |
|
126 | 126 | $ hg commit -d '0 0' -A -m a |
|
127 | 127 | adding a |
|
128 | 128 | |
|
129 | 129 | $ hg rm a |
|
130 | 130 | $ hg commit -d '1 0' -m b |
|
131 | 131 | |
|
132 | 132 | $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true -m "Backed out changeset 76862dcce372" |
|
133 | 133 | adding a |
|
134 | 134 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 |
|
135 | 135 | $ cat a |
|
136 | 136 | content |
|
137 | 137 | $ hg summary |
|
138 | 138 | parent: 2:de31bdc76c0d tip |
|
139 | 139 | Backed out changeset 76862dcce372 |
|
140 | 140 | branch: default |
|
141 | 141 | commit: (clean) |
|
142 | 142 | update: (current) |
|
143 | 143 | phases: 3 draft |
|
144 | 144 | |
|
145 | 145 | backout of backout is as if nothing happened |
|
146 | 146 | |
|
147 | 147 | $ hg backout -d '3 0' --merge tip --tool=true |
|
148 | 148 | removing a |
|
149 | 149 | changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d |
|
150 | 150 | $ test -f a |
|
151 | 151 | [1] |
|
152 | 152 | $ hg summary |
|
153 | 153 | parent: 3:7f6d0f120113 tip |
|
154 | 154 | Backed out changeset de31bdc76c0d |
|
155 | 155 | branch: default |
|
156 | 156 | commit: (clean) |
|
157 | 157 | update: (current) |
|
158 | 158 | phases: 4 draft |
|
159 | 159 | |
|
160 | 160 | Test that 'hg rollback' restores dirstate just before opening |
|
161 | 161 | transaction: in-memory dirstate changes should be written into |
|
162 | 162 | '.hg/journal.dirstate' as expected. |
|
163 | 163 | |
|
164 | 164 | $ echo 'removed soon' > b |
|
165 | 165 | $ hg commit -A -d '4 0' -m 'prepare for subsequent removing' |
|
166 | 166 | adding b |
|
167 | 167 | $ echo 'newly added' > c |
|
168 | 168 | $ hg add c |
|
169 | 169 | $ hg remove b |
|
170 | 170 | $ hg commit -d '5 0' -m 'prepare for subsequent backout' |
|
171 | 171 | $ touch -t 200001010000 c |
|
172 | 172 | $ hg status -A |
|
173 | 173 | C c |
|
174 | 174 | $ hg debugstate --no-dates |
|
175 | n 644 12 set c | |
|
175 | n 644 12 set c (no-rhg !) | |
|
176 | n 644 12 unset c (?) | |
|
177 | n 644 12 set c (?) | |
|
176 | 178 | $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r . |
|
177 | 179 | removing c |
|
178 | 180 | adding b |
|
179 | 181 | changeset 6:4bfec048029d backs out changeset 5:fac0b729a654 |
|
180 | 182 | $ hg rollback -q |
|
181 | 183 | $ hg status -A |
|
182 | 184 | A b |
|
183 | 185 | R c |
|
184 | 186 | $ hg debugstate --no-dates |
|
185 | 187 | a 0 -1 unset b |
|
186 | 188 | r 0 0 set c |
|
187 | 189 | |
|
188 | 190 | across branch |
|
189 | 191 | |
|
190 | 192 | $ cd .. |
|
191 | 193 | $ hg init branch |
|
192 | 194 | $ cd branch |
|
193 | 195 | $ echo a > a |
|
194 | 196 | $ hg ci -Am0 |
|
195 | 197 | adding a |
|
196 | 198 | $ echo b > b |
|
197 | 199 | $ hg ci -Am1 |
|
198 | 200 | adding b |
|
199 | 201 | $ hg co -C 0 |
|
200 | 202 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
201 | 203 | $ hg summary |
|
202 | 204 | parent: 0:f7b1eb17ad24 |
|
203 | 205 | 0 |
|
204 | 206 | branch: default |
|
205 | 207 | commit: (clean) |
|
206 | 208 | update: 1 new changesets (update) |
|
207 | 209 | phases: 2 draft |
|
208 | 210 | |
|
209 | 211 | should fail |
|
210 | 212 | |
|
211 | 213 | $ hg backout 1 |
|
212 | 214 | abort: cannot backout change that is not an ancestor |
|
213 | 215 | [10] |
|
214 | 216 | $ echo c > c |
|
215 | 217 | $ hg ci -Am2 |
|
216 | 218 | adding c |
|
217 | 219 | created new head |
|
218 | 220 | $ hg summary |
|
219 | 221 | parent: 2:db815d6d32e6 tip |
|
220 | 222 | 2 |
|
221 | 223 | branch: default |
|
222 | 224 | commit: (clean) |
|
223 | 225 | update: 1 new changesets, 2 branch heads (merge) |
|
224 | 226 | phases: 3 draft |
|
225 | 227 | |
|
226 | 228 | should fail |
|
227 | 229 | |
|
228 | 230 | $ hg backout 1 |
|
229 | 231 | abort: cannot backout change that is not an ancestor |
|
230 | 232 | [10] |
|
231 | 233 | $ hg summary |
|
232 | 234 | parent: 2:db815d6d32e6 tip |
|
233 | 235 | 2 |
|
234 | 236 | branch: default |
|
235 | 237 | commit: (clean) |
|
236 | 238 | update: 1 new changesets, 2 branch heads (merge) |
|
237 | 239 | phases: 3 draft |
|
238 | 240 | |
|
239 | 241 | backout with merge |
|
240 | 242 | |
|
241 | 243 | $ cd .. |
|
242 | 244 | $ hg init merge |
|
243 | 245 | $ cd merge |
|
244 | 246 | |
|
245 | 247 | $ echo line 1 > a |
|
246 | 248 | $ echo line 2 >> a |
|
247 | 249 | $ hg commit -d '0 0' -A -m a |
|
248 | 250 | adding a |
|
249 | 251 | $ hg summary |
|
250 | 252 | parent: 0:59395513a13a tip |
|
251 | 253 | a |
|
252 | 254 | branch: default |
|
253 | 255 | commit: (clean) |
|
254 | 256 | update: (current) |
|
255 | 257 | phases: 1 draft |
|
256 | 258 | |
|
257 | 259 | remove line 1 |
|
258 | 260 | |
|
259 | 261 | $ echo line 2 > a |
|
260 | 262 | $ hg commit -d '1 0' -m b |
|
261 | 263 | |
|
262 | 264 | $ echo line 3 >> a |
|
263 | 265 | $ hg commit -d '2 0' -m c |
|
264 | 266 | |
|
265 | 267 | $ hg backout --merge -d '3 0' 1 --tool=true |
|
266 | 268 | reverting a |
|
267 | 269 | created new head |
|
268 | 270 | changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 |
|
269 | 271 | merging with changeset 3:26b8ccb9ad91 |
|
270 | 272 | merging a |
|
271 | 273 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
272 | 274 | (branch merge, don't forget to commit) |
|
273 | 275 | $ hg commit -d '4 0' -m d |
|
274 | 276 | $ hg summary |
|
275 | 277 | parent: 4:c7df5e0b9c09 tip |
|
276 | 278 | d |
|
277 | 279 | branch: default |
|
278 | 280 | commit: (clean) |
|
279 | 281 | update: (current) |
|
280 | 282 | phases: 5 draft |
|
281 | 283 | |
|
282 | 284 | check line 1 is back |
|
283 | 285 | |
|
284 | 286 | $ cat a |
|
285 | 287 | line 1 |
|
286 | 288 | line 2 |
|
287 | 289 | line 3 |
|
288 | 290 | |
|
289 | 291 | Test visibility of in-memory dirstate changes outside transaction to |
|
290 | 292 | external hook process |
|
291 | 293 | |
|
292 | 294 | $ cat > $TESTTMP/checkvisibility.sh <<EOF |
|
293 | 295 | > echo "==== \$1:" |
|
294 | 296 | > hg parents --template "{rev}:{node|short}\n" |
|
295 | 297 | > echo "====" |
|
296 | 298 | > EOF |
|
297 | 299 | |
|
298 | 300 | "hg backout --merge REV1" at REV2 below implies steps below: |
|
299 | 301 | |
|
300 | 302 | (1) update to REV1 (REV2 => REV1) |
|
301 | 303 | (2) revert by REV1^1 |
|
302 | 304 | (3) commit backing out revision (REV3) |
|
303 | 305 | (4) update to REV2 (REV3 => REV2) |
|
304 | 306 | (5) merge with REV3 (REV2 => REV2, REV3) |
|
305 | 307 | |
|
306 | 308 | == test visibility to external preupdate hook |
|
307 | 309 | |
|
308 | 310 | $ hg update -q -C 2 |
|
309 | 311 | $ hg --config extensions.strip= strip 3 |
|
310 | 312 | saved backup bundle to * (glob) |
|
311 | 313 | |
|
312 | 314 | $ cat >> .hg/hgrc <<EOF |
|
313 | 315 | > [hooks] |
|
314 | 316 | > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate |
|
315 | 317 | > EOF |
|
316 | 318 | |
|
317 | 319 | ("-m" is needed to avoid writing dirstate changes out at other than |
|
318 | 320 | invocation of the hook to be examined) |
|
319 | 321 | |
|
320 | 322 | $ hg backout --merge -d '3 0' 1 --tool=true -m 'fixed comment' |
|
321 | 323 | ==== preupdate: |
|
322 | 324 | 2:6ea3f2a197a2 |
|
323 | 325 | ==== |
|
324 | 326 | reverting a |
|
325 | 327 | created new head |
|
326 | 328 | changeset 3:d92a3f57f067 backs out changeset 1:5a50a024c182 |
|
327 | 329 | ==== preupdate: |
|
328 | 330 | 3:d92a3f57f067 |
|
329 | 331 | ==== |
|
330 | 332 | merging with changeset 3:d92a3f57f067 |
|
331 | 333 | ==== preupdate: |
|
332 | 334 | 2:6ea3f2a197a2 |
|
333 | 335 | ==== |
|
334 | 336 | merging a |
|
335 | 337 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
336 | 338 | (branch merge, don't forget to commit) |
|
337 | 339 | |
|
338 | 340 | $ cat >> .hg/hgrc <<EOF |
|
339 | 341 | > [hooks] |
|
340 | 342 | > preupdate.visibility = |
|
341 | 343 | > EOF |
|
342 | 344 | |
|
343 | 345 | == test visibility to external update hook |
|
344 | 346 | |
|
345 | 347 | $ hg update -q -C 2 |
|
346 | 348 | $ hg --config extensions.strip= strip 3 |
|
347 | 349 | saved backup bundle to * (glob) |
|
348 | 350 | |
|
349 | 351 | $ cat >> .hg/hgrc <<EOF |
|
350 | 352 | > [hooks] |
|
351 | 353 | > update.visibility = sh $TESTTMP/checkvisibility.sh update |
|
352 | 354 | > EOF |
|
353 | 355 | |
|
354 | 356 | $ hg backout --merge -d '3 0' 1 --tool=true -m 'fixed comment' |
|
355 | 357 | ==== update: |
|
356 | 358 | 1:5a50a024c182 |
|
357 | 359 | ==== |
|
358 | 360 | reverting a |
|
359 | 361 | created new head |
|
360 | 362 | changeset 3:d92a3f57f067 backs out changeset 1:5a50a024c182 |
|
361 | 363 | ==== update: |
|
362 | 364 | 2:6ea3f2a197a2 |
|
363 | 365 | ==== |
|
364 | 366 | merging with changeset 3:d92a3f57f067 |
|
365 | 367 | merging a |
|
366 | 368 | ==== update: |
|
367 | 369 | 2:6ea3f2a197a2 |
|
368 | 370 | 3:d92a3f57f067 |
|
369 | 371 | ==== |
|
370 | 372 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
371 | 373 | (branch merge, don't forget to commit) |
|
372 | 374 | |
|
373 | 375 | $ cat >> .hg/hgrc <<EOF |
|
374 | 376 | > [hooks] |
|
375 | 377 | > update.visibility = |
|
376 | 378 | > EOF |
|
377 | 379 | |
|
378 | 380 | $ cd .. |
|
379 | 381 | |
|
380 | 382 | backout should not back out subsequent changesets |
|
381 | 383 | |
|
382 | 384 | $ hg init onecs |
|
383 | 385 | $ cd onecs |
|
384 | 386 | $ echo 1 > a |
|
385 | 387 | $ hg commit -d '0 0' -A -m a |
|
386 | 388 | adding a |
|
387 | 389 | $ echo 2 >> a |
|
388 | 390 | $ hg commit -d '1 0' -m b |
|
389 | 391 | $ echo 1 > b |
|
390 | 392 | $ hg commit -d '2 0' -A -m c |
|
391 | 393 | adding b |
|
392 | 394 | $ hg summary |
|
393 | 395 | parent: 2:882396649954 tip |
|
394 | 396 | c |
|
395 | 397 | branch: default |
|
396 | 398 | commit: (clean) |
|
397 | 399 | update: (current) |
|
398 | 400 | phases: 3 draft |
|
399 | 401 | |
|
400 | 402 | without --merge |
|
401 | 403 | $ hg backout --no-commit -d '3 0' 1 --tool=true |
|
402 | 404 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
403 | 405 | changeset 22bca4c721e5 backed out, don't forget to commit. |
|
404 | 406 | $ hg locate b |
|
405 | 407 | b |
|
406 | 408 | $ hg update -C tip |
|
407 | 409 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
408 | 410 | $ hg locate b |
|
409 | 411 | b |
|
410 | 412 | $ hg summary |
|
411 | 413 | parent: 2:882396649954 tip |
|
412 | 414 | c |
|
413 | 415 | branch: default |
|
414 | 416 | commit: (clean) |
|
415 | 417 | update: (current) |
|
416 | 418 | phases: 3 draft |
|
417 | 419 | |
|
418 | 420 | with --merge |
|
419 | 421 | $ hg backout --merge -d '3 0' 1 --tool=true |
|
420 | 422 | reverting a |
|
421 | 423 | created new head |
|
422 | 424 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 |
|
423 | 425 | merging with changeset 3:3202beb76721 |
|
424 | 426 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
425 | 427 | (branch merge, don't forget to commit) |
|
426 | 428 | $ hg locate b |
|
427 | 429 | b |
|
428 | 430 | $ hg update -C tip |
|
429 | 431 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
430 | 432 | $ hg locate b |
|
431 | 433 | [1] |
|
432 | 434 | |
|
433 | 435 | $ cd .. |
|
434 | 436 | $ hg init m |
|
435 | 437 | $ cd m |
|
436 | 438 | $ echo a > a |
|
437 | 439 | $ hg commit -d '0 0' -A -m a |
|
438 | 440 | adding a |
|
439 | 441 | $ echo b > b |
|
440 | 442 | $ hg commit -d '1 0' -A -m b |
|
441 | 443 | adding b |
|
442 | 444 | $ echo c > c |
|
443 | 445 | $ hg commit -d '2 0' -A -m b |
|
444 | 446 | adding c |
|
445 | 447 | $ hg update 1 |
|
446 | 448 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
447 | 449 | $ echo d > d |
|
448 | 450 | $ hg commit -d '3 0' -A -m c |
|
449 | 451 | adding d |
|
450 | 452 | created new head |
|
451 | 453 | $ hg merge 2 |
|
452 | 454 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
453 | 455 | (branch merge, don't forget to commit) |
|
454 | 456 | $ hg commit -d '4 0' -A -m d |
|
455 | 457 | $ hg summary |
|
456 | 458 | parent: 4:b2f3bb92043e tip |
|
457 | 459 | d |
|
458 | 460 | branch: default |
|
459 | 461 | commit: (clean) |
|
460 | 462 | update: (current) |
|
461 | 463 | phases: 5 draft |
|
462 | 464 | |
|
463 | 465 | backout of merge should fail |
|
464 | 466 | |
|
465 | 467 | $ hg backout 4 |
|
466 | 468 | abort: cannot backout a merge changeset |
|
467 | 469 | [10] |
|
468 | 470 | |
|
469 | 471 | backout of merge with bad parent should fail |
|
470 | 472 | |
|
471 | 473 | $ hg backout --parent 0 4 |
|
472 | 474 | abort: cb9a9f314b8b is not a parent of b2f3bb92043e |
|
473 | 475 | [10] |
|
474 | 476 | |
|
475 | 477 | backout of non-merge with parent should fail |
|
476 | 478 | |
|
477 | 479 | $ hg backout --parent 0 3 |
|
478 | 480 | abort: cannot use --parent on non-merge changeset |
|
479 | 481 | [10] |
|
480 | 482 | |
|
481 | 483 | backout with valid parent should be ok |
|
482 | 484 | |
|
483 | 485 | $ hg backout -d '5 0' --parent 2 4 --tool=true |
|
484 | 486 | removing d |
|
485 | 487 | changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e |
|
486 | 488 | $ hg summary |
|
487 | 489 | parent: 5:10e5328c8435 tip |
|
488 | 490 | Backed out changeset b2f3bb92043e |
|
489 | 491 | branch: default |
|
490 | 492 | commit: (clean) |
|
491 | 493 | update: (current) |
|
492 | 494 | phases: 6 draft |
|
493 | 495 | |
|
494 | 496 | $ hg rollback |
|
495 | 497 | repository tip rolled back to revision 4 (undo commit) |
|
496 | 498 | working directory now based on revision 4 |
|
497 | 499 | $ hg update -C |
|
498 | 500 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
499 | 501 | $ hg summary |
|
500 | 502 | parent: 4:b2f3bb92043e tip |
|
501 | 503 | d |
|
502 | 504 | branch: default |
|
503 | 505 | commit: (clean) |
|
504 | 506 | update: (current) |
|
505 | 507 | phases: 5 draft |
|
506 | 508 | |
|
507 | 509 | $ hg backout -d '6 0' --parent 3 4 --tool=true |
|
508 | 510 | removing c |
|
509 | 511 | changeset 5:033590168430 backs out changeset 4:b2f3bb92043e |
|
510 | 512 | $ hg summary |
|
511 | 513 | parent: 5:033590168430 tip |
|
512 | 514 | Backed out changeset b2f3bb92043e |
|
513 | 515 | branch: default |
|
514 | 516 | commit: (clean) |
|
515 | 517 | update: (current) |
|
516 | 518 | phases: 6 draft |
|
517 | 519 | |
|
518 | 520 | $ cd .. |
|
519 | 521 | |
|
520 | 522 | named branches |
|
521 | 523 | |
|
522 | 524 | $ hg init named_branches |
|
523 | 525 | $ cd named_branches |
|
524 | 526 | |
|
525 | 527 | $ echo default > default |
|
526 | 528 | $ hg ci -d '0 0' -Am default |
|
527 | 529 | adding default |
|
528 | 530 | $ hg branch branch1 |
|
529 | 531 | marked working directory as branch branch1 |
|
530 | 532 | (branches are permanent and global, did you want a bookmark?) |
|
531 | 533 | $ echo branch1 > file1 |
|
532 | 534 | $ hg ci -d '1 0' -Am file1 |
|
533 | 535 | adding file1 |
|
534 | 536 | $ hg branch branch2 |
|
535 | 537 | marked working directory as branch branch2 |
|
536 | 538 | $ echo branch2 > file2 |
|
537 | 539 | $ hg ci -d '2 0' -Am file2 |
|
538 | 540 | adding file2 |
|
539 | 541 | |
|
540 | 542 | without --merge |
|
541 | 543 | $ hg backout --no-commit -r 1 --tool=true |
|
542 | 544 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
543 | 545 | changeset bf1602f437f3 backed out, don't forget to commit. |
|
544 | 546 | $ hg branch |
|
545 | 547 | branch2 |
|
546 | 548 | $ hg status -A |
|
547 | 549 | R file1 |
|
548 | 550 | C default |
|
549 | 551 | C file2 |
|
550 | 552 | $ hg summary |
|
551 | 553 | parent: 2:45bbcd363bf0 tip |
|
552 | 554 | file2 |
|
553 | 555 | branch: branch2 |
|
554 | 556 | commit: 1 removed |
|
555 | 557 | update: (current) |
|
556 | 558 | phases: 3 draft |
|
557 | 559 | |
|
558 | 560 | with --merge |
|
559 | 561 | (this also tests that editor is invoked if '--edit' is specified |
|
560 | 562 | explicitly regardless of '--message') |
|
561 | 563 | |
|
562 | 564 | $ hg update -qC |
|
563 | 565 | $ HGEDITOR=cat hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true --edit |
|
564 | 566 | removing file1 |
|
565 | 567 | backout on branch1 |
|
566 | 568 | |
|
567 | 569 | |
|
568 | 570 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
569 | 571 | HG: Leave message empty to abort commit. |
|
570 | 572 | HG: -- |
|
571 | 573 | HG: user: test |
|
572 | 574 | HG: branch 'branch2' |
|
573 | 575 | HG: removed file1 |
|
574 | 576 | created new head |
|
575 | 577 | changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 |
|
576 | 578 | merging with changeset 3:d4e8f6db59fb |
|
577 | 579 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
578 | 580 | (branch merge, don't forget to commit) |
|
579 | 581 | $ hg summary |
|
580 | 582 | parent: 2:45bbcd363bf0 |
|
581 | 583 | file2 |
|
582 | 584 | parent: 3:d4e8f6db59fb tip |
|
583 | 585 | backout on branch1 |
|
584 | 586 | branch: branch2 |
|
585 | 587 | commit: 1 removed (merge) |
|
586 | 588 | update: (current) |
|
587 | 589 | phases: 4 draft |
|
588 | 590 | $ hg update -q -C 2 |
|
589 | 591 | |
|
590 | 592 | on branch2 with branch1 not merged, so file1 should still exist: |
|
591 | 593 | |
|
592 | 594 | $ hg id |
|
593 | 595 | 45bbcd363bf0 (branch2) |
|
594 | 596 | $ hg st -A |
|
595 | 597 | C default |
|
596 | 598 | C file1 |
|
597 | 599 | C file2 |
|
598 | 600 | $ hg summary |
|
599 | 601 | parent: 2:45bbcd363bf0 |
|
600 | 602 | file2 |
|
601 | 603 | branch: branch2 |
|
602 | 604 | commit: (clean) |
|
603 | 605 | update: 1 new changesets, 2 branch heads (merge) |
|
604 | 606 | phases: 4 draft |
|
605 | 607 | |
|
606 | 608 | on branch2 with branch1 merged, so file1 should be gone: |
|
607 | 609 | |
|
608 | 610 | $ hg merge |
|
609 | 611 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
610 | 612 | (branch merge, don't forget to commit) |
|
611 | 613 | $ hg ci -d '4 0' -m 'merge backout of branch1' |
|
612 | 614 | $ hg id |
|
613 | 615 | d97a8500a969 (branch2) tip |
|
614 | 616 | $ hg st -A |
|
615 | 617 | C default |
|
616 | 618 | C file2 |
|
617 | 619 | $ hg summary |
|
618 | 620 | parent: 4:d97a8500a969 tip |
|
619 | 621 | merge backout of branch1 |
|
620 | 622 | branch: branch2 |
|
621 | 623 | commit: (clean) |
|
622 | 624 | update: (current) |
|
623 | 625 | phases: 5 draft |
|
624 | 626 | |
|
625 | 627 | on branch1, so no file1 and file2: |
|
626 | 628 | |
|
627 | 629 | $ hg co -C branch1 |
|
628 | 630 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
629 | 631 | $ hg id |
|
630 | 632 | bf1602f437f3 (branch1) |
|
631 | 633 | $ hg st -A |
|
632 | 634 | C default |
|
633 | 635 | C file1 |
|
634 | 636 | $ hg summary |
|
635 | 637 | parent: 1:bf1602f437f3 |
|
636 | 638 | file1 |
|
637 | 639 | branch: branch1 |
|
638 | 640 | commit: (clean) |
|
639 | 641 | update: (current) |
|
640 | 642 | phases: 5 draft |
|
641 | 643 | |
|
642 | 644 | $ cd .. |
|
643 | 645 | |
|
644 | 646 | backout of empty changeset (issue4190) |
|
645 | 647 | |
|
646 | 648 | $ hg init emptycommit |
|
647 | 649 | $ cd emptycommit |
|
648 | 650 | |
|
649 | 651 | $ touch file1 |
|
650 | 652 | $ hg ci -Aqm file1 |
|
651 | 653 | $ hg branch -q branch1 |
|
652 | 654 | $ hg ci -qm branch1 |
|
653 | 655 | $ hg backout -v 1 |
|
654 | 656 | resolving manifests |
|
655 | 657 | nothing changed |
|
656 | 658 | [1] |
|
657 | 659 | |
|
658 | 660 | $ cd .. |
|
659 | 661 | |
|
660 | 662 | |
|
661 | 663 | Test usage of `hg resolve` in case of conflict |
|
662 | 664 | (issue4163) |
|
663 | 665 | |
|
664 | 666 | $ hg init issue4163 |
|
665 | 667 | $ cd issue4163 |
|
666 | 668 | $ touch foo |
|
667 | 669 | $ hg add foo |
|
668 | 670 | $ cat > foo << EOF |
|
669 | 671 | > one |
|
670 | 672 | > two |
|
671 | 673 | > three |
|
672 | 674 | > four |
|
673 | 675 | > five |
|
674 | 676 | > six |
|
675 | 677 | > seven |
|
676 | 678 | > height |
|
677 | 679 | > nine |
|
678 | 680 | > ten |
|
679 | 681 | > EOF |
|
680 | 682 | $ hg ci -m 'initial' |
|
681 | 683 | $ cat > foo << EOF |
|
682 | 684 | > one |
|
683 | 685 | > two |
|
684 | 686 | > THREE |
|
685 | 687 | > four |
|
686 | 688 | > five |
|
687 | 689 | > six |
|
688 | 690 | > seven |
|
689 | 691 | > height |
|
690 | 692 | > nine |
|
691 | 693 | > ten |
|
692 | 694 | > EOF |
|
693 | 695 | $ hg ci -m 'capital three' |
|
694 | 696 | $ cat > foo << EOF |
|
695 | 697 | > one |
|
696 | 698 | > two |
|
697 | 699 | > THREE |
|
698 | 700 | > four |
|
699 | 701 | > five |
|
700 | 702 | > six |
|
701 | 703 | > seven |
|
702 | 704 | > height |
|
703 | 705 | > nine |
|
704 | 706 | > TEN |
|
705 | 707 | > EOF |
|
706 | 708 | $ hg ci -m 'capital ten' |
|
707 | 709 | $ hg backout -r 'desc("capital three")' --tool internal:fail |
|
708 | 710 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
709 | 711 | use 'hg resolve' to retry unresolved file merges |
|
710 | 712 | [1] |
|
711 | 713 | $ hg status |
|
712 | 714 | $ hg debugmergestate -v |
|
713 | 715 | v1 and v2 states match: using v2 |
|
714 | 716 | local: b71750c4b0fdf719734971e3ef90dbeab5919a2d |
|
715 | 717 | other: a30dd8addae3ce71b8667868478542bc417439e6 |
|
716 | 718 | file: foo (state "u") |
|
717 | 719 | local path: foo (hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, flags "") |
|
718 | 720 | ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) |
|
719 | 721 | other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee) |
|
720 | 722 | extra: ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553 |
|
721 | 723 | extra: merged = yes |
|
722 | 724 | $ mv .hg/merge/state2 .hg/merge/state2-moved |
|
723 | 725 | $ hg debugmergestate -v |
|
724 | 726 | no version 2 merge state |
|
725 | 727 | local: b71750c4b0fdf719734971e3ef90dbeab5919a2d |
|
726 | 728 | other: b71750c4b0fdf719734971e3ef90dbeab5919a2d |
|
727 | 729 | file: foo (state "u") |
|
728 | 730 | local path: foo (hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, flags "") |
|
729 | 731 | ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) |
|
730 | 732 | other path: (node foo) |
|
731 | 733 | $ mv .hg/merge/state2-moved .hg/merge/state2 |
|
732 | 734 | $ hg resolve -l # still unresolved |
|
733 | 735 | U foo |
|
734 | 736 | $ hg summary |
|
735 | 737 | parent: 2:b71750c4b0fd tip |
|
736 | 738 | capital ten |
|
737 | 739 | branch: default |
|
738 | 740 | commit: 1 unresolved (clean) |
|
739 | 741 | update: (current) |
|
740 | 742 | phases: 3 draft |
|
741 | 743 | $ hg log -G |
|
742 | 744 | @ changeset: 2:b71750c4b0fd |
|
743 | 745 | | tag: tip |
|
744 | 746 | | user: test |
|
745 | 747 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
746 | 748 | | summary: capital ten |
|
747 | 749 | | |
|
748 | 750 | o changeset: 1:913609522437 |
|
749 | 751 | | user: test |
|
750 | 752 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
751 | 753 | | summary: capital three |
|
752 | 754 | | |
|
753 | 755 | % changeset: 0:a30dd8addae3 |
|
754 | 756 | user: test |
|
755 | 757 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
756 | 758 | summary: initial |
|
757 | 759 | |
|
758 | 760 | $ hg resolve --all --debug |
|
759 | 761 | picked tool ':merge' for foo (binary False symlink False changedelete False) |
|
760 | 762 | merging foo |
|
761 | 763 | my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437 |
|
762 | 764 | premerge successful |
|
763 | 765 | (no more unresolved files) |
|
764 | 766 | continue: hg commit |
|
765 | 767 | $ hg status |
|
766 | 768 | M foo |
|
767 | 769 | ? foo.orig |
|
768 | 770 | $ hg resolve -l |
|
769 | 771 | R foo |
|
770 | 772 | $ hg summary |
|
771 | 773 | parent: 2:b71750c4b0fd tip |
|
772 | 774 | capital ten |
|
773 | 775 | branch: default |
|
774 | 776 | commit: 1 modified, 1 unknown |
|
775 | 777 | update: (current) |
|
776 | 778 | phases: 3 draft |
|
777 | 779 | $ cat foo |
|
778 | 780 | one |
|
779 | 781 | two |
|
780 | 782 | three |
|
781 | 783 | four |
|
782 | 784 | five |
|
783 | 785 | six |
|
784 | 786 | seven |
|
785 | 787 | height |
|
786 | 788 | nine |
|
787 | 789 | TEN |
|
788 | 790 | |
|
789 | 791 | --no-commit shouldn't commit |
|
790 | 792 | |
|
791 | 793 | $ hg init a |
|
792 | 794 | $ cd a |
|
793 | 795 | $ for i in 1 2 3; do |
|
794 | 796 | > touch $i |
|
795 | 797 | > hg ci -Am $i |
|
796 | 798 | > done |
|
797 | 799 | adding 1 |
|
798 | 800 | adding 2 |
|
799 | 801 | adding 3 |
|
800 | 802 | $ hg backout --no-commit . |
|
801 | 803 | removing 3 |
|
802 | 804 | changeset cccc23d9d68f backed out, don't forget to commit. |
|
803 | 805 | $ hg revert -aq |
|
804 | 806 | |
|
805 | 807 | --no-commit can't be used with --merge |
|
806 | 808 | |
|
807 | 809 | $ hg backout --merge --no-commit 2 |
|
808 | 810 | abort: cannot specify both --no-commit and --merge |
|
809 | 811 | [10] |
|
810 | 812 | |
|
811 | 813 | Ensure that backout out the same changeset twice performs correctly: |
|
812 | 814 | |
|
813 | 815 | $ hg backout 2 |
|
814 | 816 | removing 3 |
|
815 | 817 | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f |
|
816 | 818 | $ echo 4 > 4 |
|
817 | 819 | $ hg ci -A -m 4 |
|
818 | 820 | adding 4 |
|
819 | 821 | $ hg up 2 |
|
820 | 822 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
821 | 823 | $ hg backout 2 |
|
822 | 824 | removing 3 |
|
823 | 825 | warning: commit already existed in the repository! |
|
824 | 826 | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f |
General Comments 0
You need to be logged in to leave comments.
Login now