diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -574,6 +574,7 @@ def unshelvecontinue(ui, repo, state, op _('continue an incomplete unshelve operation')), ('k', 'keep', None, _('keep shelve after unshelving')), + ('t', 'tool', '', _('specify merge tool')), ('', 'date', '', _('set date for temporary commits (DEPRECATED)'), _('DATE'))], _('hg unshelve [SHELVED]')) @@ -620,6 +621,8 @@ def unshelve(ui, repo, *shelved, **opts) if shelved: raise error.Abort(_('cannot combine abort/continue with ' 'naming a shelved change')) + if abortf and opts.get('tool', False): + ui.warn(_('tool option will be ignored\n')) try: state = shelvedstate.load(repo) @@ -648,7 +651,9 @@ def unshelve(ui, repo, *shelved, **opts) oldquiet = ui.quiet wlock = lock = tr = None + forcemerge = ui.backupconfig('ui', 'forcemerge') try: + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'unshelve') wlock = repo.wlock() lock = repo.lock() @@ -706,6 +711,7 @@ def unshelve(ui, repo, *shelved, **opts) 'rev' : [shelvectx.rev()], 'dest' : str(tmpwctx.rev()), 'keep' : True, + 'tool' : opts.get('tool', ''), }) except error.InterventionRequired: tr.close() @@ -744,6 +750,7 @@ def unshelve(ui, repo, *shelved, **opts) if tr: tr.release() lockmod.release(lock, wlock) + ui.restoreconfig(forcemerge) @command('shelve', [('A', 'addremove', None, diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -469,6 +469,29 @@ set up another conflict between a commit if we resolve a conflict while unshelving, the unshelve should succeed + $ hg unshelve --tool :merge-other --keep + unshelving change 'default' + temporarily committing pending changes (restore with 'hg unshelve --abort') + rebasing shelved changes + rebasing 6:c5e6910e7601 "changes to 'second'" (tip) + merging a/a + $ hg parents -q + 4:33f7f61e6c5e + $ hg shelve -l + default (*)* changes to 'second' (glob) + $ hg status + M a/a + A foo/foo + $ cat a/a + a + c + a + $ cat > a/a << EOF + > a + > c + > x + > EOF + $ HGMERGE=true hg unshelve unshelving change 'default' temporarily committing pending changes (restore with 'hg unshelve --abort') @@ -730,7 +753,8 @@ unshelve and conflicts with tracked and >>>>>>> source: 23b29cada8ba - shelve: changes to 'commit stuff' $ cat f.orig g - $ hg unshelve --abort + $ hg unshelve --abort -t false + tool option will be ignored rebase aborted unshelve of 'default' aborted $ hg st