[PATCH 22 of 25 RFC] shelve: write metadata file on the fly if they are missing

Boris Feld boris.feld at octobus.net
Thu Jun 7 10:11:21 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1528240201 -7200
#      Wed Jun 06 01:10:01 2018 +0200
# Node ID 40db0e66b6fe7ba86ea97de71140fe3f021863ac
# Parent  d5637aa69a9f7ce23cf89e4790b6a988725219c3
# EXP-Topic internal-phase
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 40db0e66b6fe
shelve: write metadata file on the fly if they are missing

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

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -761,6 +761,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]
 


More information about the Mercurial-devel mailing list