Patchwork D6694: unshelve: fix bug on a partial unshelve with --continue

login
register
mail settings
Submitter phabricator
Date July 26, 2019, 11:50 a.m.
Message ID <1b8e23125fb9378133e1cf623b44bb6c@localhost.localdomain>
Download mbox | patch
Permalink /patch/41076/
State Not Applicable
Headers show

Comments

phabricator - July 26, 2019, 11:50 a.m.
navaneeth.suresh updated this revision to Diff 16071.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6694?vs=16066&id=16071

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6694/new/

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

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

CHANGE DETAILS




To: navaneeth.suresh, #hg-reviewers
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
@@ -1419,3 +1419,21 @@ 
      summary:     add A to bars
   
 #endif
+
+  $ hg unshelve --continue <<EOF
+  > y
+  > y
+  > EOF
+  diff --git a/bar1 b/bar1
+  1 hunks, 1 lines changed
+  examine changes to 'bar1'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  @@ -1,2 +1,3 @@
+   A
+  +B
+   C
+  record this change to 'bar1'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  unshelve of 'default-01' complete
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -753,6 +753,15 @@ 
         if not ispartialunshelve:
             shelvedstate.clear(repo)
             unshelvecleanup(ui, repo, state.name, opts)
+        else:
+            # This is tricky. The function call might seems to be not useful.
+            # But, we do update state.parents here. Otherwise, checkparents()
+            # will fail.
+            shelvedstate.save(repo, basename, shelvectx.p1(),
+                              state.pendingctx, [nodemod.nullid],
+                              state.branchtorestore, state.keep,
+                              state.activebookmark,
+                              interactive)
         _restoreactivebookmark(repo, state.activebookmark)
         ui.status(_("unshelve of '%s' complete\n") % state.name)
 
@@ -812,6 +821,12 @@ 
     bool to know whether the shelve is partly done or completely done.
     """
     opts['message'] = shelvectx.description()
+    if not opts['message']:
+        # On doing a parial unshelve with --continue interactive, the commit
+        # description is empty. To avoid aborting on that, we set a commit
+        # message.
+        opts['message'] = ('changes to: %s' %
+                           shelvectx.p1().description().split('\n', 1)[0])
     opts['interactive-unshelve'] = True
     pats = []
     if not interactive: