7 from node import hex, nullid, short |
7 from node import hex, nullid, short |
8 from i18n import _ |
8 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 |
16 import tags as tagsmod |
16 import tags as tagsmod |
17 from lock import release |
17 from lock import release |
104 def known(self, nodes): |
104 def known(self, nodes): |
105 return self._repo.known(nodes) |
105 return self._repo.known(nodes) |
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. |
114 |
120 |
115 def unbundle(self, cg, heads, url): |
121 def unbundle(self, cg, heads, url): |