Patchwork [3,of,4] shelve: return the shelved node as part of bundle application

login
register
mail settings
Submitter Boris Feld
Date Sept. 27, 2018, 4:49 p.m.
Message ID <4deea424746d21e029ca.1538066991@localhost.localdomain>
Download mbox | patch
Permalink /patch/35133/
State Accepted
Headers show

Comments

Boris Feld - Sept. 27, 2018, 4:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1537352368 -7200
#      Wed Sep 19 12:19:28 2018 +0200
# Node ID 4deea424746d21e029caf45b10ad3cef311e92d0
# Parent  6000c641cd3740dc4d3068a05ada707213983b29
# EXP-Topic revlog-duplicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4deea424746d
shelve: return the shelved node as part of bundle application

It make sense to have the function in charge of unbundling the shelved revision
also return the node of that revision (when the data is in the bundle).

This will help us to handle unnatural state where the unshelved change already
exists in the repository.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -148,6 +148,7 @@  class shelvedfile(object):
                                 source='unshelve',
                                 url='bundle:' + self.vfs.join(self.fname),
                                 targetphase=targetphase)
+            return self.repo['tip']
         finally:
             fp.close()
 
@@ -791,8 +792,7 @@  def _unshelverestorecommit(ui, repo, bas
         node = shelvedfile(repo, basename, 'shelve').readinfo()['node']
     if node is None or node not in repo:
         with ui.configoverride({('ui', 'quiet'): True}):
-            shelvedfile(repo, basename, 'hg').applybundle()
-        shelvectx = repo['tip']
+            shelvectx = shelvedfile(repo, basename, 'hg').applybundle()
         # 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: