Mercurial > hg-stable
changeset 30463:672026aece64
shelve: move commit restoration logic to a separate function
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Thu, 10 Nov 2016 10:51:06 -0800 |
parents | 2e736f01a710 |
children | 10684a298973 |
files | hgext/shelve.py |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Sun Nov 13 03:35:52 2016 -0800 +++ b/hgext/shelve.py Thu Nov 10 10:51:06 2016 -0800 @@ -650,6 +650,14 @@ tmpwctx = repo[node] return tmpwctx, addedbefore +def _unshelverestorecommit(ui, repo, basename, oldquiet): + """Recreate commit in the repository during the unshelve""" + ui.quiet = True + shelvedfile(repo, basename, 'hg').applybundle() + shelvectx = repo['tip'] + ui.quiet = oldquiet + return repo, shelvectx + @command('unshelve', [('a', 'abort', None, _('abort an incomplete unshelve operation')), @@ -775,12 +783,7 @@ tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts, tmpwctx) - ui.quiet = True - shelvedfile(repo, basename, 'hg').applybundle() - - ui.quiet = oldquiet - - shelvectx = repo['tip'] + repo, shelvectx = _unshelverestorecommit(ui, repo, basename, oldquiet) branchtorestore = '' if shelvectx.branch() != shelvectx.p1().branch():