Show More
@@ -526,22 +526,24 b' def archive(ui, repo, dest, **opts):' | |||
|
526 | 526 | |
|
527 | 527 | @command('backout', |
|
528 | 528 | [('', 'merge', None, _('merge with old dirstate parent after backout')), |
|
529 | ('', 'commit', None, _('commit if no conflicts were encountered')), | |
|
529 | ('', 'commit', None, | |
|
530 | _('commit if no conflicts were encountered (DEPRECATED)')), | |
|
531 | ('', 'no-commit', None, _('do not commit')), | |
|
530 | 532 | ('', 'parent', '', |
|
531 | 533 | _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), |
|
532 | 534 | ('r', 'rev', '', _('revision to backout'), _('REV')), |
|
533 | 535 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
534 | 536 | ] + mergetoolopts + walkopts + commitopts + commitopts2, |
|
535 | 537 | _('[OPTION]... [-r] REV')) |
|
536 |
def backout(ui, repo, node=None, rev=None, |
|
|
538 | def backout(ui, repo, node=None, rev=None, **opts): | |
|
537 | 539 | '''reverse effect of earlier changeset |
|
538 | 540 | |
|
539 | 541 | Prepare a new changeset with the effect of REV undone in the |
|
540 | current working directory. | |
|
542 | current working directory. If no conflicts were encountered, | |
|
543 | it will be committed immediately. | |
|
541 | 544 | |
|
542 | 545 | If REV is the parent of the working directory, then this new changeset |
|
543 | is committed automatically. Otherwise, hg needs to merge the | |
|
544 | changes and the merged result is left uncommitted. | |
|
546 | is committed automatically (unless --no-commit is specified). | |
|
545 | 547 | |
|
546 | 548 | .. note:: |
|
547 | 549 | |
@@ -560,12 +562,12 b' def backout(ui, repo, node=None, rev=Non' | |||
|
560 | 562 | - Reverse the effect of previous bad revision 23:: |
|
561 | 563 | |
|
562 | 564 | hg backout -r 23 |
|
563 | hg commit -m "Backout revision 23" | |
|
564 | 565 | |
|
565 | 566 | - Reverse the effect of previous bad revision 23 and |
|
566 | commit the backout immediately:: | |
|
567 | ||
|
568 | hg backout -r 23 --commit | |
|
567 | leave changes uncommitted:: | |
|
568 | ||
|
569 | hg backout -r 23 --no-commit | |
|
570 | hg commit -m "Backout revision 23" | |
|
569 | 571 | |
|
570 | 572 | By default, the pending changeset will have one parent, |
|
571 | 573 | maintaining a linear history. With --merge, the pending |
@@ -589,11 +591,14 b' def backout(ui, repo, node=None, rev=Non' | |||
|
589 | 591 | try: |
|
590 | 592 | wlock = repo.wlock() |
|
591 | 593 | lock = repo.lock() |
|
592 |
return _dobackout(ui, repo, node, rev, |
|
|
594 | return _dobackout(ui, repo, node, rev, **opts) | |
|
593 | 595 | finally: |
|
594 | 596 | release(lock, wlock) |
|
595 | 597 | |
|
596 |
def _dobackout(ui, repo, node=None, rev=None, |
|
|
598 | def _dobackout(ui, repo, node=None, rev=None, **opts): | |
|
599 | if opts.get('commit') and opts.get('no_commit'): | |
|
600 | raise error.Abort(_("cannot use --commit with --no-commit")) | |
|
601 | ||
|
597 | 602 | if rev and node: |
|
598 | 603 | raise error.Abort(_("please specify just one revision")) |
|
599 | 604 | |
@@ -648,7 +653,7 b' def _dobackout(ui, repo, node=None, rev=' | |||
|
648 | 653 | repo.ui.status(_("use 'hg resolve' to retry unresolved " |
|
649 | 654 | "file merges\n")) |
|
650 | 655 | return 1 |
|
651 |
elif |
|
|
656 | elif opts.get('no_commit'): | |
|
652 | 657 | msg = _("changeset %s backed out, " |
|
653 | 658 | "don't forget to commit.\n") |
|
654 | 659 | ui.status(msg % short(node)) |
@@ -61,7 +61,7 b' commit option' | |||
|
61 | 61 | $ echo grapes >> a |
|
62 | 62 | $ hg commit -d '2 0' -m grapes |
|
63 | 63 | |
|
64 |
$ hg backout |
|
|
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 |
@@ -75,7 +75,7 b' commit option' | |||
|
75 | 75 | $ echo ypples > a |
|
76 | 76 | $ hg commit -d '5 0' -m ypples |
|
77 | 77 | |
|
78 |
$ hg backout |
|
|
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] |
@@ -371,7 +371,7 b' backout should not back out subsequent c' | |||
|
371 | 371 | phases: 3 draft |
|
372 | 372 | |
|
373 | 373 | without --merge |
|
374 | $ hg backout -d '3 0' 1 --tool=true | |
|
374 | $ hg backout --no-commit -d '3 0' 1 --tool=true | |
|
375 | 375 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
376 | 376 | changeset 22bca4c721e5 backed out, don't forget to commit. |
|
377 | 377 | $ hg locate b |
@@ -511,7 +511,7 b' named branches' | |||
|
511 | 511 | adding file2 |
|
512 | 512 | |
|
513 | 513 | without --merge |
|
514 | $ hg backout -r 1 --tool=true | |
|
514 | $ hg backout --no-commit -r 1 --tool=true | |
|
515 | 515 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
516 | 516 | changeset bf1602f437f3 backed out, don't forget to commit. |
|
517 | 517 | $ hg branch |
@@ -224,7 +224,7 b' Show all commands + options' | |||
|
224 | 224 | update: clean, check, date, rev, tool |
|
225 | 225 | addremove: similarity, subrepos, include, exclude, dry-run |
|
226 | 226 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
227 | backout: merge, commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
|
227 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
|
228 | 228 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
229 | 229 | bookmarks: force, rev, delete, rename, inactive, template |
|
230 | 230 | branch: force, clean |
@@ -1288,7 +1288,7 b' Test restricted mode with graft' | |||
|
1288 | 1288 | |
|
1289 | 1289 | Test restricted mode with backout |
|
1290 | 1290 | |
|
1291 | $ hg backout -q 11 | |
|
1291 | $ hg backout -q 11 --no-commit | |
|
1292 | 1292 | $ hg diff a |
|
1293 | 1293 | diff -r 01a68de1003a a |
|
1294 | 1294 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
@@ -671,7 +671,7 b' update' | |||
|
671 | 671 | backout calls revert internally with minimal opts, which should not raise |
|
672 | 672 | KeyError |
|
673 | 673 | |
|
674 | $ hg backout ".^" | |
|
674 | $ hg backout ".^" --no-commit | |
|
675 | 675 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
676 | 676 | changeset c373c8102e68 backed out, don't forget to commit. |
|
677 | 677 |
General Comments 0
You need to be logged in to leave comments.
Login now