##// END OF EJS Templates
bundle2: return a stream from exchange.getbundle...
Pierre-Yves David -
r21068:c15b66a6 default
parent child Browse files
Show More
@@ -659,7 +659,7 b' def getbundle(repo, source, heads=None, '
659 bundler = bundle2.bundle20(repo.ui)
659 bundler = bundle2.bundle20(repo.ui)
660 part = bundle2.bundlepart('changegroup', data=cg.getchunks())
660 part = bundle2.bundlepart('changegroup', data=cg.getchunks())
661 bundler.addpart(part)
661 bundler.addpart(part)
662 return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks()))
662 return util.chunkbuffer(bundler.getchunks())
663
663
664 class PushRaced(RuntimeError):
664 class PushRaced(RuntimeError):
665 """An exception raised during unbundling that indicate a push race"""
665 """An exception raised during unbundling that indicate a push race"""
@@ -9,7 +9,7 b' from i18n import _'
9 import peer, changegroup, subrepo, pushkey, obsolete, repoview
9 import peer, changegroup, subrepo, pushkey, obsolete, repoview
10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
11 import lock as lockmod
11 import lock as lockmod
12 import transaction, store, encoding, exchange
12 import transaction, store, encoding, exchange, bundle2
13 import scmutil, util, extensions, hook, error, revset
13 import scmutil, util, extensions, hook, error, revset
14 import match as matchmod
14 import match as matchmod
15 import merge as mergemod
15 import merge as mergemod
@@ -106,8 +106,14 b' class localpeer(peer.peerrepository):'
106
106
107 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
107 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
108 format='HG10'):
108 format='HG10'):
109 return exchange.getbundle(self._repo, source, heads=heads,
109 cg = exchange.getbundle(self._repo, source, heads=heads,
110 common=common, bundlecaps=bundlecaps)
110 common=common, bundlecaps=bundlecaps)
111 if bundlecaps is not None and 'HG20' in bundlecaps:
112 # When requesting a bundle2, getbundle returns a stream to make the
113 # wire level function happier. We need to build a proper object
114 # from it in local peer.
115 cg = bundle2.unbundle20(self.ui, cg)
116 return cg
111
117
112 # TODO We might want to move the next two calls into legacypeer and add
118 # TODO We might want to move the next two calls into legacypeer and add
113 # unbundle instead.
119 # unbundle instead.
General Comments 0
You need to be logged in to leave comments. Login now