changeset 42726:6957f7b93e03

unshelve: clear shelvedstate and _finishunshelve() on partial unshelve On a partial unshelve, `shelvedstate` was not cleared and `_finishunshelve()` was not called. Ideally, these should be called on this case. This patch makes `shelvedstate` to delete after a successful partial unshelve and calls `_finishunshelve()` in the same case. Differential Revision: https://phab.mercurial-scm.org/D6708
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Sat, 27 Jul 2019 12:19:51 +0530
parents 073cfff9aaef
children 049b2ac3252e
files mercurial/shelve.py tests/test-shelve.t
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Thu Jul 25 22:01:15 2019 +0530
+++ b/mercurial/shelve.py	Sat Jul 27 12:19:51 2019 +0530
@@ -1003,11 +1003,10 @@
         with ui.configoverride(overrides, 'unshelve'):
             mergefiles(ui, repo, pctx, shelvectx)
         restorebranch(ui, repo, branchtorestore)
+        shelvedstate.clear(repo)
+        _finishunshelve(repo, oldtiprev, tr, activebookmark)
         if not ispartialunshelve:
             _forgetunknownfiles(repo, shelvectx, addedbefore)
-
-            shelvedstate.clear(repo)
-            _finishunshelve(repo, oldtiprev, tr, activebookmark)
             unshelvecleanup(ui, repo, basename, opts)
     finally:
         if tr:
--- a/tests/test-shelve.t	Thu Jul 25 22:01:15 2019 +0530
+++ b/tests/test-shelve.t	Sat Jul 27 12:19:51 2019 +0530
@@ -1239,6 +1239,7 @@
   > y
   > EOF
   unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
   diff --git a/d b/d
   new file mode 100644
@@ -1250,6 +1251,10 @@
   record this change to 'd'?
   (enter ? for help) [Ynesfdaq?] y
   
+
+  $ hg status -v
+  A c
+  A d
   $ ls
   b
   c
@@ -1360,19 +1365,19 @@
 
 #if stripbased
   $ hg log -r 3:: -G
-  @  changeset:   5:506510493902
+  @  changeset:   5:f1d5f53e397b
   |  tag:         tip
-  |  parent:      3:adfeba9a1ac4
+  |  parent:      3:e28fd7fa7938
   |  user:        shelve@localhost
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     changes to: add A to bars
   |
-  | @  changeset:   4:8b023952e29c
+  | @  changeset:   4:fe451a778c81
   |/   user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
   |    summary:     add C to bars
   |
-  o  changeset:   3:adfeba9a1ac4
+  o  changeset:   3:e28fd7fa7938
   |  user:        test
   ~  date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     add A to bars
@@ -1413,13 +1418,13 @@
 
 #if stripbased
   $ hg log -r 3:: -G
-  @  changeset:   4:8b023952e29c
+  @  changeset:   4:fe451a778c81
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     add C to bars
   |
-  o  changeset:   3:adfeba9a1ac4
+  o  changeset:   3:e28fd7fa7938
   |  user:        test
   ~  date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     add A to bars