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