Mercurial > hg
changeset 27021:f2554154509f
unshelve: add support for custom merge tools
For parity with merge --tool, rebase --tool etc.
rebase.rebase overwrites the tool in repo.ui, so we need to explicitly pass it
down there too.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 18 Nov 2015 15:11:23 -0800 |
parents | cc2049184ece |
children | 35102876d648 |
files | hgext/shelve.py tests/test-shelve.t |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Wed Nov 18 15:18:16 2015 -0800 +++ b/hgext/shelve.py Wed Nov 18 15:11:23 2015 -0800 @@ -574,6 +574,7 @@ _('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 @@ 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 @@ 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 @@ 'rev' : [shelvectx.rev()], 'dest' : str(tmpwctx.rev()), 'keep' : True, + 'tool' : opts.get('tool', ''), }) except error.InterventionRequired: tr.close() @@ -744,6 +750,7 @@ if tr: tr.release() lockmod.release(lock, wlock) + ui.restoreconfig(forcemerge) @command('shelve', [('A', 'addremove', None,
--- a/tests/test-shelve.t Wed Nov 18 15:18:16 2015 -0800 +++ b/tests/test-shelve.t Wed Nov 18 15:11:23 2015 -0800 @@ -469,6 +469,29 @@ 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 @@ >>>>>>> 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