changeset 42702:4814d993fe21

unshelve: handle stripping changesets on interactive mode On interactive mode, changesets on `nodestoremove` should be stripped regardless of the shelve is partial or not. This patch modifies `unshelvecontinue()` to do that. Differential Revision: https://phab.mercurial-scm.org/D6686
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Wed, 24 Jul 2019 18:15:27 +0530
parents 11498aa91c03
children 073cfff9aaef
files mercurial/shelve.py tests/test-shelve.t
diffstat 2 files changed, 42 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Tue Aug 06 14:54:25 2019 +0200
+++ b/mercurial/shelve.py	Wed Jul 24 18:15:27 2019 +0530
@@ -747,10 +747,10 @@
         mergefiles(ui, repo, state.wctx, shelvectx)
         restorebranch(ui, repo, state.branchtorestore)
 
+        if not phases.supportinternal(repo):
+            repair.strip(ui, repo, state.nodestoremove, backup=False,
+                         topic='shelve')
         if not ispartialunshelve:
-            if not phases.supportinternal(repo):
-                repair.strip(ui, repo, state.nodestoremove, backup=False,
-                            topic='shelve')
             shelvedstate.clear(repo)
             unshelvecleanup(ui, repo, state.name, opts)
         _restoreactivebookmark(repo, state.activebookmark)
--- a/tests/test-shelve.t	Tue Aug 06 14:54:25 2019 +0200
+++ b/tests/test-shelve.t	Wed Jul 24 18:15:27 2019 +0530
@@ -1357,11 +1357,33 @@
   A
   B
   C
+
+#if stripbased
+  $ hg log -r 3:: -G
+  @  changeset:   5:506510493902
+  |  tag:         tip
+  |  parent:      3:adfeba9a1ac4
+  |  user:        shelve@localhost
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     changes to: add A to bars
+  |
+  | @  changeset:   4:8b023952e29c
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add C to bars
+  |
+  o  changeset:   3:adfeba9a1ac4
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add A to bars
+  
+#endif
+
   $ hg unshelve --continue <<EOF
   > y
   > y
   > y
-  > y
+  > n
   > EOF
   diff --git a/bar1 b/bar1
   1 hunks, 1 lines changed
@@ -1385,6 +1407,21 @@
   +B
    C
   record change 2/2 to 'bar2'?
-  (enter ? for help) [Ynesfdaq?] y
+  (enter ? for help) [Ynesfdaq?] n
   
   unshelve of 'default-01' complete
+
+#if stripbased
+  $ hg log -r 3:: -G
+  @  changeset:   4:8b023952e29c
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add C to bars
+  |
+  o  changeset:   3:adfeba9a1ac4
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add A to bars
+  
+#endif