Mercurial > hg-stable
comparison tests/test-branch-change.t @ 40707:69268a13ffa5
branch: allow changing branch of merge commits with --rev
Tests show that changing branch of merge commits works fine with evolution and
without, so let's allow it. Other safeguards should prevent users from shooting
themselves in the foot.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 09 Nov 2018 13:57:13 +0800 |
parents | ebb75443969a |
children | c7d236b55a3e |
comparison
equal
deleted
inserted
replaced
40706:fb379b78b93e | 40707:69268a13ffa5 |
---|---|
306 o 19:fd45b986b109 Added b | 306 o 19:fd45b986b109 Added b |
307 | stable () | 307 | stable () |
308 o 18:204d2769eca2 Added a | 308 o 18:204d2769eca2 Added a |
309 stable () | 309 stable () |
310 | 310 |
311 Testing on merge | 311 Changing branch of a merge commit |
312 | 312 |
313 $ hg merge -r 26 | 313 $ hg branch -q ghi |
314 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 314 $ echo f > f |
315 $ hg ci -qAm 'Added f' | |
316 $ hg up -q 27 | |
317 $ hg branch -q jkl | |
318 $ echo g > g | |
319 $ hg ci -qAm 'Added g' | |
320 $ hg glog -r 'heads(:)' | |
321 @ 29:6bc1c6c2c9da Added g | |
322 | jkl () | |
323 ~ | |
324 o 28:2f1019bd29d2 Added f | |
325 | ghi (b1) | |
326 ~ | |
327 | |
328 $ hg branch -q default | |
329 $ hg merge -r 28 | |
330 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
315 (branch merge, don't forget to commit) | 331 (branch merge, don't forget to commit) |
316 | |
317 $ hg branch -r . abcd | 332 $ hg branch -r . abcd |
318 abort: outstanding uncommitted merge | 333 abort: outstanding uncommitted merge |
319 [255] | 334 [255] |
335 | |
320 $ hg ci -m "Merge commit" | 336 $ hg ci -m "Merge commit" |
321 $ hg branch -r '(.^)::' def | 337 $ hg glog -r 'parents(.)::' |
322 abort: cannot change branch of a merge commit | 338 @ 30:4d56e6b1eb6b Merge commit |
339 |\ default () | |
340 | o 29:6bc1c6c2c9da Added g | |
341 | | jkl () | |
342 | ~ | |
343 o 28:2f1019bd29d2 Added f | |
344 | ghi (b1) | |
345 ~ | |
346 | |
347 $ hg branch -r . ghi | |
348 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
349 changed branch on 1 changesets | |
350 $ hg branch -r . jkl | |
351 changed branch on 1 changesets | |
352 $ hg branch -r . default | |
353 changed branch on 1 changesets | |
354 $ hg branch -r . stable | |
355 abort: a branch of the same name already exists | |
323 [255] | 356 [255] |
324 | 357 |
325 Changing branch on public changeset | 358 Changing branch on public changeset |
326 | 359 |
327 $ hg phase -r 27 -p | 360 $ hg phase -r . -p |
328 $ hg branch -r 27 def | 361 $ hg branch -r . def |
329 abort: cannot change branch of public changesets | 362 abort: cannot change branch of public changesets |
330 (see 'hg help phases' for details) | 363 (see 'hg help phases' for details) |
331 [255] | 364 [255] |
365 | |
366 Merge commit with conflicts, with evolution and without | |
367 | |
368 $ mklozenge() { | |
369 > echo foo > a | |
370 > hg ci -qAm foo | |
371 > echo bar > a | |
372 > hg ci -qm bar | |
373 > hg up -q '.^' | |
374 > echo baz > a | |
375 > hg ci -qm baz | |
376 > hg merge -q -t :local | |
377 > echo neither > a | |
378 > hg ci -qm neither | |
379 > } | |
380 | |
381 $ cd .. | |
382 $ hg init merge-with-evolution | |
383 $ cd merge-with-evolution | |
384 $ mklozenge | |
385 | |
386 $ hg branch -r '(.^)::' abc | |
387 changed branch on 2 changesets | |
388 $ hg glog | |
389 @ 5:c07fa8b34d54 neither | |
390 |\ abc () | |
391 | o 4:f2aa51777cc9 baz | |
392 | | abc () | |
393 o | 1:2e33c4f0856b bar | |
394 |/ default () | |
395 o 0:91cfb6004abf foo | |
396 default () | |
397 $ hg cat a | |
398 neither | |
399 | |
400 $ cd .. | |
401 $ hg init merge-without-evolution | |
402 $ cd merge-without-evolution | |
403 $ mklozenge | |
404 $ cat > .hg/hgrc << EOF | |
405 > [experimental] | |
406 > evolution = no | |
407 > evolution.allowunstable = no | |
408 > EOF | |
409 | |
410 $ hg branch -r '(.^)::' abc | |
411 changed branch on 2 changesets | |
412 saved backup bundle to $TESTTMP/merge-without-evolution/.hg/strip-backup/9a3a2af368f4-8db1a361-branch-change.hg | |
413 $ hg glog | |
414 @ 3:c07fa8b34d54 neither | |
415 |\ abc () | |
416 | o 2:f2aa51777cc9 baz | |
417 | | abc () | |
418 o | 1:2e33c4f0856b bar | |
419 |/ default () | |
420 o 0:91cfb6004abf foo | |
421 default () | |
422 $ hg cat a | |
423 neither |