shelve: return the shelved node as part of bundle application
authorBoris Feld <boris.feld@octobus.net>
Wed, 19 Sep 2018 12:19:28 +0200
changeset 39888 42a6b228dd2e
parent 39887 a3095bc47217
child 39889 d9ba836fc234
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.
hgext/shelve.py
--- a/hgext/shelve.py	Thu Sep 20 11:18:28 2018 +0200
+++ b/hgext/shelve.py	Wed Sep 19 12:19:28 2018 +0200
@@ -148,6 +148,7 @@
                                 source='unshelve',
                                 url='bundle:' + self.vfs.join(self.fname),
                                 targetphase=targetphase)
+            return self.repo['tip']
         finally:
             fp.close()
 
@@ -791,8 +792,7 @@
         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: