Show More
@@ -114,6 +114,7 b' def wirereposetup(ui, repo):' | |||||
114 | _('putlfile failed (unexpected response):'), ret) |
|
114 | _('putlfile failed (unexpected response):'), ret) | |
115 |
|
115 | |||
116 | def getlfile(self, sha): |
|
116 | def getlfile(self, sha): | |
|
117 | """returns an iterable with the chunks of the file with sha sha""" | |||
117 | stream = self._callstream("getlfile", sha=sha) |
|
118 | stream = self._callstream("getlfile", sha=sha) | |
118 | length = stream.readline() |
|
119 | length = stream.readline() | |
119 | try: |
|
120 | try: | |
@@ -121,7 +122,12 b' def wirereposetup(ui, repo):' | |||||
121 | except ValueError: |
|
122 | except ValueError: | |
122 | self._abort(error.ResponseError(_("unexpected response:"), |
|
123 | self._abort(error.ResponseError(_("unexpected response:"), | |
123 | length)) |
|
124 | length)) | |
124 | return (length, stream) |
|
125 | ||
|
126 | # Mercurial doesn't close SSH connections after writing a stream | |||
|
127 | infile = lfutil.limitreader(stream, length) | |||
|
128 | for chunk in util.filechunkiter(infile, 128 * 1024): | |||
|
129 | yield chunk | |||
|
130 | infile.close() | |||
125 |
|
131 | |||
126 | @batchable |
|
132 | @batchable | |
127 | def statlfile(self, sha): |
|
133 | def statlfile(self, sha): |
@@ -58,7 +58,7 b' class remotestore(basestore.basestore):' | |||||
58 | 'statlfile (%r)' % stat) |
|
58 | 'statlfile (%r)' % stat) | |
59 |
|
59 | |||
60 | try: |
|
60 | try: | |
61 |
|
|
61 | chunks = self._get(hash) | |
62 | except urllib2.HTTPError, e: |
|
62 | except urllib2.HTTPError, e: | |
63 | # 401s get converted to util.Aborts; everything else is fine being |
|
63 | # 401s get converted to util.Aborts; everything else is fine being | |
64 | # turned into a StoreError |
|
64 | # turned into a StoreError | |
@@ -71,14 +71,7 b' class remotestore(basestore.basestore):' | |||||
71 | except IOError, e: |
|
71 | except IOError, e: | |
72 | raise basestore.StoreError(filename, hash, self.url, str(e)) |
|
72 | raise basestore.StoreError(filename, hash, self.url, str(e)) | |
73 |
|
73 | |||
74 | # Mercurial does not close its SSH connections after writing a stream |
|
74 | return lfutil.copyandhash(chunks, tmpfile) | |
75 | if length is not None: |
|
|||
76 | infile = lfutil.limitreader(infile, length) |
|
|||
77 | try: |
|
|||
78 | return lfutil.copyandhash(util.filechunkiter(infile, 128 * 1024), |
|
|||
79 | tmpfile) |
|
|||
80 | finally: |
|
|||
81 | infile.close() |
|
|||
82 |
|
75 | |||
83 | def _verifyfile(self, cctx, cset, contents, standin, verified): |
|
76 | def _verifyfile(self, cctx, cset, contents, standin, verified): | |
84 | filename = lfutil.splitstandin(standin) |
|
77 | filename = lfutil.splitstandin(standin) |
General Comments 0
You need to be logged in to leave comments.
Login now