--- a/mercurial/commands.py Fri Oct 22 17:08:15 2010 +0200
+++ b/mercurial/commands.py Fri Oct 22 11:58:43 2010 -0500
@@ -278,7 +278,11 @@
revert_opts['no_backup'] = None
revert(ui, repo, **revert_opts)
if not opts.get('merge') and op1 != node:
- return hg.update(repo, op1)
+ try:
+ ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
+ return hg.update(repo, op1)
+ finally:
+ ui.setconfig('ui', 'forcemerge', '')
commit_opts = opts.copy()
commit_opts['addremove'] = False
@@ -295,7 +299,11 @@
hg.clean(repo, op1, show_stats=False)
ui.status(_('merging with changeset %s\n')
% nice(repo.changelog.tip()))
- return hg.merge(repo, hex(repo.changelog.tip()))
+ try:
+ ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
+ return hg.merge(repo, hex(repo.changelog.tip()))
+ finally:
+ ui.setconfig('ui', 'forcemerge', '')
return 0
def bisect(ui, repo, rev=None, extra=None, command=None,
@@ -4005,6 +4013,8 @@
_('merge with old dirstate parent after backout')),
('', 'parent', '',
_('parent to choose when backing out merge'), _('REV')),
+ ('t', 'tool', '',
+ _('specify merge tool')),
('r', 'rev', '',
_('revision to backout'), _('REV')),
] + walkopts + commitopts + commitopts2,
--- a/tests/test-backout.t Fri Oct 22 17:08:15 2010 +0200
+++ b/tests/test-backout.t Fri Oct 22 11:58:43 2010 -0500
@@ -1,5 +1,3 @@
- $ HGMERGE=true; export HGMERGE
-
$ hg init basic
$ cd basic
@@ -20,7 +18,7 @@
$ echo b >> a
$ hg commit -d '1 0' -m b
- $ hg backout -d '2 0' tip
+ $ hg backout -d '2 0' tip --tool=true
reverting a
changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57
$ cat a
@@ -39,7 +37,7 @@
$ hg rm a
$ hg commit -d '1 0' -m b
- $ hg backout -d '2 0' tip
+ $ hg backout -d '2 0' tip --tool=true
adding a
changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
$ cat a
@@ -47,7 +45,7 @@
backout of backout is as if nothing happened
- $ hg backout -d '3 0' --merge tip
+ $ hg backout -d '3 0' --merge tip --tool=true
removing a
changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
$ cat a 2>/dev/null || echo cat: a: No such file or directory
@@ -102,7 +100,7 @@
$ echo line 3 >> a
$ hg commit -d '2 0' -m c
- $ hg backout --merge -d '3 0' 1
+ $ hg backout --merge -d '3 0' 1 --tool=true
reverting a
created new head
changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182
@@ -133,7 +131,7 @@
adding b
without --merge
- $ hg backout -d '3 0' 1
+ $ hg backout -d '3 0' 1 --tool=true
reverting a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg locate b
@@ -144,7 +142,7 @@
b
with --merge
- $ hg backout --merge -d '3 0' 1
+ $ hg backout --merge -d '3 0' 1 --tool=true
reverting a
created new head
changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
@@ -201,7 +199,7 @@
backout with valid parent should be ok
- $ hg backout -d '5 0' --parent 2 4
+ $ hg backout -d '5 0' --parent 2 4 --tool=true
removing d
changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
@@ -210,7 +208,7 @@
$ hg update -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ hg backout -d '6 0' --parent 3 4
+ $ hg backout -d '6 0' --parent 3 4 --tool=true
removing c
changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
@@ -236,7 +234,7 @@
adding file2
without --merge
- $ hg backout -r 1
+ $ hg backout -r 1 --tool=true
removing file1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch
@@ -248,7 +246,7 @@
with --merge
$ hg update -qC
- $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1'
+ $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true
removing file1
created new head
changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
--- a/tests/test-debugcomplete.t Fri Oct 22 17:08:15 2010 +0200
+++ b/tests/test-debugcomplete.t Fri Oct 22 11:58:43 2010 -0500
@@ -196,7 +196,7 @@
update: clean, check, date, rev
addremove: similarity, include, exclude, dry-run
archive: no-decode, prefix, rev, type, subrepos, include, exclude
- backout: merge, parent, rev, include, exclude, message, logfile, date, user
+ backout: merge, parent, tool, rev, include, exclude, message, logfile, date, user
bisect: reset, good, bad, skip, command, noupdate
branch: force, clean
branches: active, closed