Patchwork [06,of,10] shelve: look for shelved not in the repository before unbundling

login
register
mail settings
Submitter Boris Feld
Date Aug. 29, 2018, 4:30 p.m.
Message ID <e56dd355b971632ef95f.1535560254@localhost.localdomain>
Download mbox | patch
Permalink /patch/34150/
State Accepted
Headers show

Comments

Boris Feld - Aug. 29, 2018, 4:30 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1528239442 -7200
#      Wed Jun 06 00:57:22 2018 +0200
# Node ID e56dd355b971632ef95fbbf07445547ea6d30f88
# Parent  a000c7acde68b242548a33f08aa7b84c303f197e
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e56dd355b971
shelve: look for shelved not in the repository before unbundling

This prepares the version of shelve that would not strip the shelved node from
the repository. If we have the node information, search for it in the
repository and only fallback on unbundling if it is missing.

To be able to find such nodes, we operate on an unfiltered repository.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -764,9 +764,15 @@  def _commitworkingcopychanges(ui, repo, 
 def _unshelverestorecommit(ui, repo, basename):
     """Recreate commit in the repository during the unshelve"""
     repo = repo.unfiltered()
-    with ui.configoverride({('ui', 'quiet'): True}):
-        shelvedfile(repo, basename, 'hg').applybundle()
+    if shelvedfile(repo, basename, 'shelve').exists():
+        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']
+    else:
+        shelvectx = repo[node]
+
     return repo, shelvectx
 
 def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx,