Show More
@@ -17,7 +17,9 b' def zgenerator(f):' | |||||
17 | zd = zlib.decompressobj() |
|
17 | zd = zlib.decompressobj() | |
18 | try: |
|
18 | try: | |
19 | for chunk in util.filechunkiter(f): |
|
19 | for chunk in util.filechunkiter(f): | |
20 |
|
|
20 | while chunk: | |
|
21 | yield zd.decompress(chunk, 2**18) | |||
|
22 | chunk = zd.unconsumed_tail | |||
21 | except httplib.HTTPException: |
|
23 | except httplib.HTTPException: | |
22 | raise IOError(None, _('connection ended unexpectedly')) |
|
24 | raise IOError(None, _('connection ended unexpectedly')) | |
23 | yield zd.flush() |
|
25 | yield zd.flush() |
@@ -323,6 +323,7 b' def applyupdates(repo, action, wctx, mct' | |||||
323 | repo.ui.note(_("getting %s\n") % f) |
|
323 | repo.ui.note(_("getting %s\n") % f) | |
324 | t = mctx.filectx(f).data() |
|
324 | t = mctx.filectx(f).data() | |
325 | repo.wwrite(f, t, flags) |
|
325 | repo.wwrite(f, t, flags) | |
|
326 | t = None | |||
326 | updated += 1 |
|
327 | updated += 1 | |
327 | if f == '.hgsubstate': # subrepo states need updating |
|
328 | if f == '.hgsubstate': # subrepo states need updating | |
328 | subrepo.submerge(repo, wctx, mctx, wctx) |
|
329 | subrepo.submerge(repo, wctx, mctx, wctx) |
@@ -1041,6 +1041,9 b' class revlog(object):' | |||||
1041 | base = self._cache[1] |
|
1041 | base = self._cache[1] | |
1042 | text = self._cache[2] |
|
1042 | text = self._cache[2] | |
1043 |
|
1043 | |||
|
1044 | # drop cache to save memory | |||
|
1045 | self._cache = None | |||
|
1046 | ||||
1044 | self._loadindex(base, rev + 1) |
|
1047 | self._loadindex(base, rev + 1) | |
1045 | self._chunkraw(base, rev) |
|
1048 | self._chunkraw(base, rev) | |
1046 | if text is None: |
|
1049 | if text is None: |
@@ -925,30 +925,36 b' class chunkbuffer(object):' | |||||
925 | else: |
|
925 | else: | |
926 | yield chunk |
|
926 | yield chunk | |
927 | self.iter = splitbig(in_iter) |
|
927 | self.iter = splitbig(in_iter) | |
928 |
self. |
|
928 | self._queue = [] | |
929 |
|
929 | |||
930 | def read(self, l): |
|
930 | def read(self, l): | |
931 | """Read L bytes of data from the iterator of chunks of data. |
|
931 | """Read L bytes of data from the iterator of chunks of data. | |
932 | Returns less than L bytes if the iterator runs dry.""" |
|
932 | Returns less than L bytes if the iterator runs dry.""" | |
933 | if l > len(self.buf) and self.iter: |
|
933 | left = l | |
934 | # Clamp to a multiple of 2**16 |
|
934 | buf = '' | |
935 | targetsize = max(l, 2**16) |
|
935 | queue = self._queue | |
936 | collector = [str(self.buf)] |
|
936 | while left > 0: | |
937 | collected = len(self.buf) |
|
937 | # refill the queue | |
938 |
f |
|
938 | if not queue: | |
939 | collector.append(chunk) |
|
939 | target = 2**18 | |
940 | collected += len(chunk) |
|
940 | for chunk in self.iter: | |
941 | if collected >= targetsize: |
|
941 | queue.append(chunk) | |
|
942 | target -= len(chunk) | |||
|
943 | if target <= 0: | |||
|
944 | break | |||
|
945 | if not queue: | |||
942 | break |
|
946 | break | |
|
947 | ||||
|
948 | chunk = queue.pop(0) | |||
|
949 | left -= len(chunk) | |||
|
950 | if left < 0: | |||
|
951 | queue.insert(0, chunk[left:]) | |||
|
952 | buf += chunk[:left] | |||
943 | else: |
|
953 | else: | |
944 |
|
|
954 | buf += chunk | |
945 | self.buf = ''.join(collector) |
|
|||
946 | if len(self.buf) == l: |
|
|||
947 | s, self.buf = str(self.buf), '' |
|
|||
948 | else: |
|
|||
949 | s, self.buf = self.buf[:l], buffer(self.buf, l) |
|
|||
950 | return s |
|
|||
951 |
|
955 | |||
|
956 | return buf | |||
|
957 | ||||
952 | def filechunkiter(f, size=65536, limit=None): |
|
958 | def filechunkiter(f, size=65536, limit=None): | |
953 | """Create a generator that produces the data in the file size |
|
959 | """Create a generator that produces the data in the file size | |
954 | (default 65536) bytes at a time, up to optional limit (default is |
|
960 | (default 65536) bytes at a time, up to optional limit (default is |
@@ -48,6 +48,8 b' def _verify(repo):' | |||||
48 | if isinstance(inst, KeyboardInterrupt): |
|
48 | if isinstance(inst, KeyboardInterrupt): | |
49 | ui.warn(_("interrupted")) |
|
49 | ui.warn(_("interrupted")) | |
50 | raise |
|
50 | raise | |
|
51 | if not str(inst): | |||
|
52 | inst = repr(inst) | |||
51 | err(linkrev, "%s: %s" % (msg, inst), filename) |
|
53 | err(linkrev, "%s: %s" % (msg, inst), filename) | |
52 |
|
54 | |||
53 | def warn(msg): |
|
55 | def warn(msg): | |
@@ -229,6 +231,7 b' def _verify(repo):' | |||||
229 |
|
231 | |||
230 | checklog(fl, f, lr) |
|
232 | checklog(fl, f, lr) | |
231 | seen = {} |
|
233 | seen = {} | |
|
234 | rp = None | |||
232 | for i in fl: |
|
235 | for i in fl: | |
233 | revisions += 1 |
|
236 | revisions += 1 | |
234 | n = fl.node(i) |
|
237 | n = fl.node(i) | |
@@ -241,12 +244,12 b' def _verify(repo):' | |||||
241 |
|
244 | |||
242 | # verify contents |
|
245 | # verify contents | |
243 | try: |
|
246 | try: | |
244 |
|
|
247 | l = len(fl.read(n)) | |
245 | rp = fl.renamed(n) |
|
248 | rp = fl.renamed(n) | |
246 |
if l |
|
249 | if l != fl.size(i): | |
247 | if len(fl.revision(n)) != fl.size(i): |
|
250 | if len(fl.revision(n)) != fl.size(i): | |
248 | err(lr, _("unpacked size is %s, %s expected") % |
|
251 | err(lr, _("unpacked size is %s, %s expected") % | |
249 |
(l |
|
252 | (l, fl.size(i)), f) | |
250 | except Exception, inst: |
|
253 | except Exception, inst: | |
251 | exc(lr, _("unpacking %s") % short(n), inst, f) |
|
254 | exc(lr, _("unpacking %s") % short(n), inst, f) | |
252 |
|
255 |
General Comments 0
You need to be logged in to leave comments.
Login now