Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlerepo.py @ 12335:e21fe9c5fb25
bundle: get rid of chunkiter
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 19 Sep 2010 12:51:54 -0500 |
parents | 44c7dfc2f6a3 |
children | 6277a9469dff |
comparison
equal
deleted
inserted
replaced
12334:50946802593d | 12335:e21fe9c5fb25 |
---|---|
31 # | 31 # |
32 revlog.revlog.__init__(self, opener, indexfile) | 32 revlog.revlog.__init__(self, opener, indexfile) |
33 self.bundle = bundle | 33 self.bundle = bundle |
34 self.basemap = {} | 34 self.basemap = {} |
35 def chunkpositer(): | 35 def chunkpositer(): |
36 for chunk in bundle.chunks(): | 36 while 1: |
37 chunk = bundle.chunk() | |
38 if not chunk: | |
39 break | |
37 pos = bundle.tell() | 40 pos = bundle.tell() |
38 yield chunk, pos - len(chunk) | 41 yield chunk, pos - len(chunk) |
39 n = len(self) | 42 n = len(self) |
40 prev = None | 43 prev = None |
41 for chunk, start in chunkpositer(): | 44 for chunk, start in chunkpositer(): |
228 while 1: | 231 while 1: |
229 chunk = self.bundle.chunk() | 232 chunk = self.bundle.chunk() |
230 if not chunk: | 233 if not chunk: |
231 break | 234 break |
232 self.bundlefilespos[chunk] = self.bundle.tell() | 235 self.bundlefilespos[chunk] = self.bundle.tell() |
233 for c in self.bundle.chunks(): | 236 while 1: |
234 pass | 237 c = self.bundle.chunk() |
238 if not c: | |
239 break | |
235 | 240 |
236 if f[0] == '/': | 241 if f[0] == '/': |
237 f = f[1:] | 242 f = f[1:] |
238 if f in self.bundlefilespos: | 243 if f in self.bundlefilespos: |
239 self.bundle.seek(self.bundlefilespos[f]) | 244 self.bundle.seek(self.bundlefilespos[f]) |