##// END OF EJS Templates
shelve: get rid of ui.backupconfig
Jun Wu -
r31462:d1ce2124 default
parent child Browse files
Show More
@@ -314,17 +314,16 b' def getcommitfunc(extra, interactive, ed'
314 hasmq = util.safehasattr(repo, 'mq')
314 hasmq = util.safehasattr(repo, 'mq')
315 if hasmq:
315 if hasmq:
316 saved, repo.mq.checkapplied = repo.mq.checkapplied, False
316 saved, repo.mq.checkapplied = repo.mq.checkapplied, False
317 backup = repo.ui.backupconfig('phases', 'new-commit')
317 overrides = {('phases', 'new-commit'): phases.secret}
318 try:
318 try:
319 repo.ui.setconfig('phases', 'new-commit', phases.secret)
320 editor_ = False
319 editor_ = False
321 if editor:
320 if editor:
322 editor_ = cmdutil.getcommiteditor(editform='shelve.shelve',
321 editor_ = cmdutil.getcommiteditor(editform='shelve.shelve',
323 **opts)
322 **opts)
324 return repo.commit(message, shelveuser, opts.get('date'), match,
323 with repo.ui.configoverride(overrides):
325 editor=editor_, extra=extra)
324 return repo.commit(message, shelveuser, opts.get('date'),
325 match, editor=editor_, extra=extra)
326 finally:
326 finally:
327 repo.ui.restoreconfig(backup)
328 if hasmq:
327 if hasmq:
329 repo.mq.checkapplied = saved
328 repo.mq.checkapplied = saved
330
329
@@ -850,9 +849,7 b' def _dounshelve(ui, repo, *shelved, **op'
850
849
851 oldquiet = ui.quiet
850 oldquiet = ui.quiet
852 lock = tr = None
851 lock = tr = None
853 forcemerge = ui.backupconfig('ui', 'forcemerge')
854 try:
852 try:
855 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'unshelve')
856 lock = repo.lock()
853 lock = repo.lock()
857
854
858 tr = repo.transaction('unshelve', report=lambda x: None)
855 tr = repo.transaction('unshelve', report=lambda x: None)
@@ -866,31 +863,33 b' def _dounshelve(ui, repo, *shelved, **op'
866 # and shelvectx is the unshelved changes. Then we merge it all down
863 # and shelvectx is the unshelved changes. Then we merge it all down
867 # to the original pctx.
864 # to the original pctx.
868
865
869 tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts,
866 overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
870 tmpwctx)
867 with ui.configoverride(overrides, 'unshelve'):
871
868 tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts,
872 repo, shelvectx = _unshelverestorecommit(ui, repo, basename, oldquiet)
869 tmpwctx)
873 _checkunshelveuntrackedproblems(ui, repo, shelvectx)
874 branchtorestore = ''
875 if shelvectx.branch() != shelvectx.p1().branch():
876 branchtorestore = shelvectx.branch()
877
870
878 shelvectx = _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev,
871 repo, shelvectx = _unshelverestorecommit(ui, repo, basename,
879 basename, pctx, tmpwctx, shelvectx,
872 oldquiet)
880 branchtorestore)
873 _checkunshelveuntrackedproblems(ui, repo, shelvectx)
881 mergefiles(ui, repo, pctx, shelvectx)
874 branchtorestore = ''
882 restorebranch(ui, repo, branchtorestore)
875 if shelvectx.branch() != shelvectx.p1().branch():
883 _forgetunknownfiles(repo, shelvectx, addedbefore)
876 branchtorestore = shelvectx.branch()
884
877
885 shelvedstate.clear(repo)
878 shelvectx = _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev,
886 _finishunshelve(repo, oldtiprev, tr)
879 basename, pctx, tmpwctx,
887 unshelvecleanup(ui, repo, basename, opts)
880 shelvectx, branchtorestore)
881 mergefiles(ui, repo, pctx, shelvectx)
882 restorebranch(ui, repo, branchtorestore)
883 _forgetunknownfiles(repo, shelvectx, addedbefore)
884
885 shelvedstate.clear(repo)
886 _finishunshelve(repo, oldtiprev, tr)
887 unshelvecleanup(ui, repo, basename, opts)
888 finally:
888 finally:
889 ui.quiet = oldquiet
889 ui.quiet = oldquiet
890 if tr:
890 if tr:
891 tr.release()
891 tr.release()
892 lockmod.release(lock)
892 lockmod.release(lock)
893 ui.restoreconfig(forcemerge)
894
893
895 @command('shelve',
894 @command('shelve',
896 [('A', 'addremove', None,
895 [('A', 'addremove', None,
General Comments 0
You need to be logged in to leave comments. Login now