diff hgext/shelve.py @ 38466:61e4cf1be5b2

shelve: directly handle the abort process Shelve is currently sub-contracting some of its work to the rebase extension. In order to make shelve more independent and flexible we would like shelve to handle the parent alignment directly. This change starts with the simplest bits, handling the abort process. It turns out we have all the necessary bits in the `shelvestate` file. So we do not need anything from the interrupted rebase. As a nice side effect, a test about missing `shelverebasestate` state file now behave better. Differential Revision: https://phab.mercurial-scm.org/D3688
author Boris Feld <boris.feld@octobus.net>
date Mon, 28 May 2018 18:15:21 +0200
parents 7932be8b0559
children f4776f8b98e0
line wrap: on
line diff
--- a/hgext/shelve.py	Mon May 28 20:51:20 2018 +0200
+++ b/hgext/shelve.py	Mon May 28 18:15:21 2018 +0200
@@ -621,14 +621,14 @@
         try:
             checkparents(repo, state)
 
-            repo.vfs.rename('unshelverebasestate', 'rebasestate')
-            try:
-                rebase.rebase(ui, repo, **{
-                    r'abort' : True
-                })
-            except Exception:
-                repo.vfs.rename('rebasestate', 'unshelverebasestate')
-                raise
+            merge.update(repo, state.pendingctx, False, True)
+            if (state.activebookmark
+                    and state.activebookmark in repo._bookmarks):
+                bookmarks.activate(repo, state.activebookmark)
+
+            if repo.vfs.exists('unshelverebasestate'):
+                repo.vfs.rename('unshelverebasestate', 'rebasestate')
+                rebase.clearstatus(repo)
 
             mergefiles(ui, repo, state.wctx, state.pendingctx)
             repair.strip(ui, repo, state.nodestoremove, backup=False,