Patchwork D3688: shelve: directly handle the abort process

login
register
mail settings
Submitter phabricator
Date June 25, 2018, 3:21 p.m.
Message ID <c32ac3f092050a851f2a03889b518294@localhost.localdomain>
Download mbox | patch
Permalink /patch/32422/
State Not Applicable
Headers show

Comments

phabricator - June 25, 2018, 3:21 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG61e4cf1be5b2: shelve: directly handle the abort process (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3688?vs=8976&id=9289

REVISION DETAIL
  https://phab.mercurial-scm.org/D3688

AFFECTED FILES
  hgext/shelve.py
  tests/test-shelve.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -406,7 +406,6 @@ 
   R b/b
   ? a/a.orig
   $ hg unshelve -a
-  rebase aborted
   unshelve of 'default' aborted
   $ hg heads -q
   3:2e69b451d1ea
@@ -817,7 +816,6 @@ 
   g
   $ hg unshelve --abort -t false
   tool option will be ignored
-  rebase aborted
   unshelve of 'default' aborted
   $ hg st
   M a
@@ -861,7 +859,6 @@ 
   $ cat f.orig
   g
   $ hg unshelve --abort
-  rebase aborted
   unshelve of 'default' aborted
   $ hg st
   ? f.orig
@@ -1271,14 +1268,8 @@ 
   $ rm .hg/unshelverebasestate
   $ hg unshelve --abort
   unshelve of 'default' aborted
-  abort: $ENOENT$* (glob)
-  [255]
-Can the user leave the current state?
-  $ hg up -C .
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Try again but with a corrupted shelve state file
-  $ hg strip -r 406ad6fb39eb -r e22bdf25c863 -q
   $ hg up -r 0 -q
   $ echo '' > root
   $ hg shelve -q
@@ -1290,7 +1281,6 @@ 
   $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate
   $ mv ../corrupt-shelvedstate .hg/histedit-state
   $ hg unshelve --abort 2>&1 | grep 'aborted'
-  rebase aborted
   unshelve of 'default-01' aborted
   $ hg summary
   parent: 0:ae8c668541e8 tip
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -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,