hgext/shelve.py
changeset 39744 52dfa1eb0ad4
parent 39601 84d6e9a2b104
child 39888 42a6b228dd2e
--- a/hgext/shelve.py	Wed Sep 19 12:07:52 2018 -0700
+++ b/hgext/shelve.py	Wed Jun 06 02:31:46 2018 +0200
@@ -434,7 +434,14 @@
         repo[None].add(s.unknown)
 
 def _finishshelve(repo):
-    _aborttransaction(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"""
@@ -652,8 +659,9 @@
                 rebase.clearstatus(repo)
 
             mergefiles(ui, repo, state.wctx, state.pendingctx)
-            repair.strip(ui, repo, state.nodestoremove, backup=False,
-                         topic='shelve')
+            if not phases.supportinternal(repo):
+                repair.strip(ui, repo, state.nodestoremove, backup=False,
+                             topic='shelve')
         finally:
             shelvedstate.clear(repo)
             ui.warn(_("unshelve of '%s' aborted\n") % state.name)
@@ -746,8 +754,9 @@
         mergefiles(ui, repo, state.wctx, shelvectx)
         restorebranch(ui, repo, state.branchtorestore)
 
-        repair.strip(ui, repo, state.nodestoremove, backup=False,
-                     topic='shelve')
+        if not phases.supportinternal(repo):
+            repair.strip(ui, repo, state.nodestoremove, backup=False,
+                         topic='shelve')
         _restoreactivebookmark(repo, state.activebookmark)
         shelvedstate.clear(repo)
         unshelvecleanup(ui, repo, state.name, opts)