From patchwork Wed Aug 29 16:30:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07, of, 10] shelve: write metadata file on the fly if they are missing From: Boris Feld X-Patchwork-Id: 34151 Message-Id: <95c87531a5cc2f5ee8ef.1535560255@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Cc: raf@durin42.com Date: Wed, 29 Aug 2018 18:30:55 +0200 # HG changeset patch # User Boris Feld # 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). 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]