##// END OF EJS Templates
shelve: move ui.quiet manipulations to configoverride
Kostia Balytskyi -
r31757:473f2fcc default
parent child Browse files
Show More
@@ -592,9 +592,7 def unshelveabort(ui, repo, state, opts)
592 def mergefiles(ui, repo, wctx, shelvectx):
592 def mergefiles(ui, repo, wctx, shelvectx):
593 """updates to wctx and merges the changes from shelvectx into the
593 """updates to wctx and merges the changes from shelvectx into the
594 dirstate."""
594 dirstate."""
595 oldquiet = ui.quiet
595 with ui.configoverride({('ui', 'quiet'): True}):
596 try:
597 ui.quiet = True
598 hg.update(repo, wctx.node())
596 hg.update(repo, wctx.node())
599 files = []
597 files = []
600 files.extend(shelvectx.files())
598 files.extend(shelvectx.files())
@@ -609,8 +607,6 def mergefiles(ui, repo, wctx, shelvectx
609 *pathtofiles(repo, files),
607 *pathtofiles(repo, files),
610 **{'no_backup': True})
608 **{'no_backup': True})
611 ui.popbuffer()
609 ui.popbuffer()
612 finally:
613 ui.quiet = oldquiet
614
610
615 def restorebranch(ui, repo, branchtorestore):
611 def restorebranch(ui, repo, branchtorestore):
616 if branchtorestore and branchtorestore != repo.dirstate.branch():
612 if branchtorestore and branchtorestore != repo.dirstate.branch():
@@ -680,17 +676,16 def _commitworkingcopychanges(ui, repo,
680 tempopts = {}
676 tempopts = {}
681 tempopts['message'] = "pending changes temporary commit"
677 tempopts['message'] = "pending changes temporary commit"
682 tempopts['date'] = opts.get('date')
678 tempopts['date'] = opts.get('date')
683 ui.quiet = True
679 with ui.configoverride({('ui', 'quiet'): True}):
684 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
680 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
685 tmpwctx = repo[node]
681 tmpwctx = repo[node]
686 return tmpwctx, addedbefore
682 return tmpwctx, addedbefore
687
683
688 def _unshelverestorecommit(ui, repo, basename, oldquiet):
684 def _unshelverestorecommit(ui, repo, basename):
689 """Recreate commit in the repository during the unshelve"""
685 """Recreate commit in the repository during the unshelve"""
690 ui.quiet = True
686 with ui.configoverride({('ui', 'quiet'): True}):
691 shelvedfile(repo, basename, 'hg').applybundle()
687 shelvedfile(repo, basename, 'hg').applybundle()
692 shelvectx = repo['tip']
688 shelvectx = repo['tip']
693 ui.quiet = oldquiet
694 return repo, shelvectx
689 return repo, shelvectx
695
690
696 def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx,
691 def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx,
@@ -873,11 +868,9 def _dounshelve(ui, repo, *shelved, **op
873 if not shelvedfile(repo, basename, patchextension).exists():
868 if not shelvedfile(repo, basename, patchextension).exists():
874 raise error.Abort(_("shelved change '%s' not found") % basename)
869 raise error.Abort(_("shelved change '%s' not found") % basename)
875
870
876 oldquiet = ui.quiet
877 lock = tr = None
871 lock = tr = None
878 try:
872 try:
879 lock = repo.lock()
873 lock = repo.lock()
880
881 tr = repo.transaction('unshelve', report=lambda x: None)
874 tr = repo.transaction('unshelve', report=lambda x: None)
882 oldtiprev = len(repo)
875 oldtiprev = len(repo)
883
876
@@ -894,9 +887,7 def _dounshelve(ui, repo, *shelved, **op
894 with ui.configoverride(overrides, 'unshelve'):
887 with ui.configoverride(overrides, 'unshelve'):
895 tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts,
888 tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts,
896 tmpwctx)
889 tmpwctx)
897
890 repo, shelvectx = _unshelverestorecommit(ui, repo, basename)
898 repo, shelvectx = _unshelverestorecommit(ui, repo, basename,
899 oldquiet)
900 _checkunshelveuntrackedproblems(ui, repo, shelvectx)
891 _checkunshelveuntrackedproblems(ui, repo, shelvectx)
901 branchtorestore = ''
892 branchtorestore = ''
902 if shelvectx.branch() != shelvectx.p1().branch():
893 if shelvectx.branch() != shelvectx.p1().branch():
@@ -914,7 +905,6 def _dounshelve(ui, repo, *shelved, **op
914 _finishunshelve(repo, oldtiprev, tr, activebookmark)
905 _finishunshelve(repo, oldtiprev, tr, activebookmark)
915 unshelvecleanup(ui, repo, basename, opts)
906 unshelvecleanup(ui, repo, basename, opts)
916 finally:
907 finally:
917 ui.quiet = oldquiet
918 if tr:
908 if tr:
919 tr.release()
909 tr.release()
920 lockmod.release(lock)
910 lockmod.release(lock)
General Comments 0
You need to be logged in to leave comments. Login now