Patchwork [07,of,10] shelve: write metadata file on the fly if they are missing

login
register
mail settings
Submitter Boris Feld
Date Aug. 29, 2018, 4:30 p.m.
Message ID <95c87531a5cc2f5ee8ef.1535560255@localhost.localdomain>
Download mbox | patch
Permalink /patch/34151/
State Accepted
Headers show

Comments

Boris Feld - Aug. 29, 2018, 4:30 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1528240201 -7200
#      Wed Jun 06 01:10:01 2018 +0200
# Node ID 95c87531a5cc2f5ee8efad0243bdcbe9a38d883a
# Parent  e56dd355b971632ef95fbbf07445547ea6d30f88
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 95c87531a5cc
shelve: write metadata file on the fly if they are missing

Keeping an explicit reference to the shelve node in order to reuse it directly
if the unshelved is repeated (eg: unshelve --keep).

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -770,6 +770,11 @@  def _unshelverestorecommit(ui, repo, bas
         with ui.configoverride({('ui', 'quiet'): True}):
             shelvedfile(repo, basename, 'hg').applybundle()
         shelvectx = repo['tip']
+        # We might no strip the unbundled changeset, so we should keep track of
+        # the unshelve node in case we need to reuse it (eg: unshelve --keep)
+        if node is None:
+            info = {'node': nodemod.hex(node)}
+            shelvedfile(repo, basename, 'shelve').writeinfo(info)
     else:
         shelvectx = repo[node]