Show More
@@ -8,6 +8,7 | |||||
8 |
|
8 | |||
9 | from node import nullid |
|
9 | from node import nullid | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
|
11 | import tempfile | |||
11 | import changegroup, statichttprepo, error, httpconnection, url, util, wireproto |
|
12 | import changegroup, statichttprepo, error, httpconnection, url, util, wireproto | |
12 | import os, urllib, urllib2, zlib, httplib |
|
13 | import os, urllib, urllib2, zlib, httplib | |
13 | import errno, socket |
|
14 | import errno, socket | |
@@ -211,6 +212,27 class httppeer(wireproto.wirepeer): | |||||
211 | fp.close() |
|
212 | fp.close() | |
212 | os.unlink(tempname) |
|
213 | os.unlink(tempname) | |
213 |
|
214 | |||
|
215 | def _calltwowaystream(self, cmd, fp, **args): | |||
|
216 | fh = None | |||
|
217 | filename = None | |||
|
218 | try: | |||
|
219 | # dump bundle to disk | |||
|
220 | fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") | |||
|
221 | fh = os.fdopen(fd, "wb") | |||
|
222 | d = fp.read(4096) | |||
|
223 | while d: | |||
|
224 | fh.write(d) | |||
|
225 | d = fp.read(4096) | |||
|
226 | fh.close() | |||
|
227 | # start http push | |||
|
228 | fp = httpconnection.httpsendfile(self.ui, filename, "rb") | |||
|
229 | headers = {'Content-Type': 'application/mercurial-0.1'} | |||
|
230 | return self._callstream(cmd, data=fp, headers=headers, **args) | |||
|
231 | finally: | |||
|
232 | if fh is not None: | |||
|
233 | fh.close() | |||
|
234 | os.unlink(filename) | |||
|
235 | ||||
214 | def _callcompressable(self, cmd, **args): |
|
236 | def _callcompressable(self, cmd, **args): | |
215 | stream = self._callstream(cmd, **args) |
|
237 | stream = self._callstream(cmd, **args) | |
216 | return util.chunkbuffer(zgenerator(stream)) |
|
238 | return util.chunkbuffer(zgenerator(stream)) |
General Comments 0
You need to be logged in to leave comments.
Login now