diff -r 073cfff9aaef -r 6957f7b93e03 mercurial/shelve.py --- a/mercurial/shelve.py Thu Jul 25 22:01:15 2019 +0530 +++ b/mercurial/shelve.py Sat Jul 27 12:19:51 2019 +0530 @@ -1003,11 +1003,10 @@ with ui.configoverride(overrides, 'unshelve'): mergefiles(ui, repo, pctx, shelvectx) restorebranch(ui, repo, branchtorestore) + shelvedstate.clear(repo) + _finishunshelve(repo, oldtiprev, tr, activebookmark) if not ispartialunshelve: _forgetunknownfiles(repo, shelvectx, addedbefore) - - shelvedstate.clear(repo) - _finishunshelve(repo, oldtiprev, tr, activebookmark) unshelvecleanup(ui, repo, basename, opts) finally: if tr: