comparison mercurial/httppeer.py @ 28666:ae53ecc47414

bundle: move writebundle() from changegroup.py to bundle2.py (API) writebundle() writes a bundle2 bundle or a plain changegroup1. Imagine away the "2" in "bundle2.py" for a moment and this change should makes sense. The bundle wraps the changegroup, so it makes sense that it knows about it. Another sign that this is correct is that the delayed import of bundle2 in changegroup goes away. I'll leave it for another time to remove the "2" in "bundle2.py" (alternatively, extract a new bundle.py from it).
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 28 Mar 2016 14:41:29 -0700
parents fd2acc5046f6
children 032c4c2f802a
comparison
equal deleted inserted replaced
28655:0e330d7d9f53 28666:ae53ecc47414
18 import zlib 18 import zlib
19 19
20 from .i18n import _ 20 from .i18n import _
21 from .node import nullid 21 from .node import nullid
22 from . import ( 22 from . import (
23 changegroup, 23 bundle2,
24 error, 24 error,
25 httpconnection, 25 httpconnection,
26 statichttprepo, 26 statichttprepo,
27 url, 27 url,
28 util, 28 util,
220 # servers older than d1b16a746db6 will send 'unbundle' as a 220 # servers older than d1b16a746db6 will send 'unbundle' as a
221 # boolean capability. They only support headerless/uncompressed 221 # boolean capability. They only support headerless/uncompressed
222 # bundles. 222 # bundles.
223 types = [""] 223 types = [""]
224 for x in types: 224 for x in types:
225 if x in changegroup.bundletypes: 225 if x in bundle2.bundletypes:
226 type = x 226 type = x
227 break 227 break
228 228
229 tempname = changegroup.writebundle(self.ui, cg, None, type) 229 tempname = bundle2.writebundle(self.ui, cg, None, type)
230 fp = httpconnection.httpsendfile(self.ui, tempname, "rb") 230 fp = httpconnection.httpsendfile(self.ui, tempname, "rb")
231 headers = {'Content-Type': 'application/mercurial-0.1'} 231 headers = {'Content-Type': 'application/mercurial-0.1'}
232 232
233 try: 233 try:
234 r = self._call(cmd, data=fp, headers=headers, **args) 234 r = self._call(cmd, data=fp, headers=headers, **args)