diff -r 6d61be152c55 -r d684449eef67 mercurial/shelve.py --- a/mercurial/shelve.py Thu Aug 08 01:59:43 2019 +0200 +++ b/mercurial/shelve.py Tue Aug 13 22:48:05 2019 +0530 @@ -1005,8 +1005,8 @@ restorebranch(ui, repo, branchtorestore) shelvedstate.clear(repo) _finishunshelve(repo, oldtiprev, tr, activebookmark) + _forgetunknownfiles(repo, shelvectx, addedbefore) if not ispartialunshelve: - _forgetunknownfiles(repo, shelvectx, addedbefore) unshelvecleanup(ui, repo, basename, opts) finally: if tr: