changeset 42703:073cfff9aaef

unshelve: delete shelvedstate after a successful unshelve --continue `unshelve --continue` was preventing the deletion of `shelvedstate` on a partial `unshelve`. Ideally, `shelvedstate` should be deleted after a successful `unshelve`. Now, the behavior of `unshelve --continue` will be as follows in interactive mode: 1] The user tried to `unshelve` changes interactively but, ran into conflicts. 2] They resolved the conflicts and triggered `unshelve --continue` but, unshelved changes partially. 3] Now, on trying to do `unshelve --continue` again will abort as the last `unshelve` was successful and we are deleting the `shelvedstate`. 4] If they want to unshelve the remaining shelved change, they need to trigger `unshelve` without `--continue`. Differential Revision: https://phab.mercurial-scm.org/D6694
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Thu, 25 Jul 2019 22:01:15 +0530
parents 4814d993fe21
children 6957f7b93e03
files mercurial/shelve.py tests/test-shelve.t
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Wed Jul 24 18:15:27 2019 +0530
+++ b/mercurial/shelve.py	Thu Jul 25 22:01:15 2019 +0530
@@ -750,8 +750,8 @@
         if not phases.supportinternal(repo):
             repair.strip(ui, repo, state.nodestoremove, backup=False,
                          topic='shelve')
+        shelvedstate.clear(repo)
         if not ispartialunshelve:
-            shelvedstate.clear(repo)
             unshelvecleanup(ui, repo, state.name, opts)
         _restoreactivebookmark(repo, state.activebookmark)
         ui.status(_("unshelve of '%s' complete\n") % state.name)
--- a/tests/test-shelve.t	Wed Jul 24 18:15:27 2019 +0530
+++ b/tests/test-shelve.t	Thu Jul 25 22:01:15 2019 +0530
@@ -1425,3 +1425,29 @@
      summary:     add A to bars
   
 #endif
+
+  $ hg unshelve --continue
+  abort: no unshelve in progress
+  [255]
+
+  $ hg shelve --list
+  default-01      (*)* changes to: add A to bars (glob)
+  default         (*)* changes to: add B to foo (glob)
+  $ hg unshelve -n default-01 -i <<EOF
+  > y
+  > y
+  > EOF
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
+  diff --git a/bar2 b/bar2
+  1 hunks, 1 lines changed
+  examine changes to 'bar2'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  @@ -1,2 +1,3 @@
+   A
+  +B
+   C
+  record this change to 'bar2'?
+  (enter ? for help) [Ynesfdaq?] y
+