Patchwork [10,of,14,FIX-bundle2] shelve: properly process bundle2 bundle

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 20, 2015, 2:36 p.m.
Message ID <e9701075984882bbdbb6.1445351786@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11190/
State Accepted
Commit ae03d419032128267c91894d72cfef40db28c313
Headers show

Comments

Pierre-Yves David - Oct. 20, 2015, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1445262170 -7200
#      Mon Oct 19 15:42:50 2015 +0200
# Node ID e9701075984882bbdbb6ab5a4b8cf5e7fb27e80a
# Parent  8ede0199ba8248090263b1cf870c1468431726bd
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r e97010759848
shelve: properly process bundle2 bundle

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -25,11 +25,11 @@  import collections
 import itertools
 from mercurial.i18n import _
 from mercurial.node import nullid, nullrev, bin, hex
 from mercurial import changegroup, cmdutil, scmutil, phases, commands
 from mercurial import error, hg, mdiff, merge, patch, repair, util
-from mercurial import templatefilters, exchange, bundlerepo
+from mercurial import templatefilters, exchange, bundlerepo, bundle2
 from mercurial import lock as lockmod
 from hgext import rebase
 import errno
 
 cmdtable = {}
@@ -94,13 +94,19 @@  class shelvedfile(object):
 
     def applybundle(self):
         fp = self.opener()
         try:
             gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs)
-            gen.apply(self.repo, 'unshelve',
-                      'bundle:' + self.vfs.join(self.fname),
-                      targetphase=phases.secret)
+            if not isinstance(gen, bundle2.unbundle20):
+                gen.apply(self.repo, 'unshelve',
+                          'bundle:' + self.vfs.join(self.fname),
+                          targetphase=phases.secret)
+            if isinstance(gen, bundle2.unbundle20):
+                bundle2.applybundle(self.repo, gen,
+                                    self.repo.currenttransaction(),
+                                    source='unshelve',
+                                    url='bundle:' + self.vfs.join(self.fname))
         finally:
             fp.close()
 
     def bundlerepo(self):
         return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root,