shelve: drop unnecessary backup of dirstate for phase-based case
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 05 Dec 2018 14:08:01 -0800
changeset 53618 d7e44da4dc706e1755a02aab7452320a1c4a22d8
parent 53617 1b836cee2d9139e566df2e44ca7583557d35d2cf
child 53619 236af7cfa4c3dfe358ec4f0f4f1c9590298a200c
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
shelve: drop unnecessary backup of dirstate for phase-based case Regular shelve has a hack using an uncommitted transaction that's then aborted at the end of the operation. It preserves the dirstate across the abort, however, by saving a backup copy of it. Phase-based shelve instead commits the transaction, so the hack shouldn't be necessary there. Differential Revision: https://phab.mercurial-scm.org/D5389
hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -441,21 +441,18 @@ def _includeunknownfiles(repo, pats, opt
     s = repo.status(match=scmutil.match(repo[None], pats, opts),
                     unknown=True)
     if s.unknown:
         extra['shelve_unknown'] = '\0'.join(s.unknown)
         repo[None].add(s.unknown)
 
 def _finishshelve(repo):
     if phases.supportinternal(repo):
-        backupname = 'dirstate.shelve'
         tr = repo.currenttransaction()
-        repo.dirstate.savebackup(tr, backupname)
         tr.close()
-        repo.dirstate.restorebackup(None, backupname)
     else:
         _aborttransaction(repo)
 
 def createcmd(ui, repo, pats, opts):
     """subcommand that creates a new shelve"""
     with repo.wlock():
         cmdutil.checkunfinished(repo)
         return _docreatecmd(ui, repo, pats, opts)