shelve: write metadata file on the fly if they are missing
authorBoris Feld <boris.feld@octobus.net>
Wed, 06 Jun 2018 01:10:01 +0200
changeset 39375 38373da1af02
parent 39374 c67c94c0e7ae
child 39376 5f8282f368b2
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).
hgext/shelve.py
--- a/hgext/shelve.py	Wed Jun 06 00:57:22 2018 +0200
+++ b/hgext/shelve.py	Wed Jun 06 01:10:01 2018 +0200
@@ -770,6 +770,11 @@
         with ui.configoverride({('ui', 'quiet'): True}):
             shelvedfile(repo, basename, 'hg').applybundle()
         shelvectx = repo['tip']
+        # We might not 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]