Mercurial > hg
comparison mercurial/bundlerepo.py @ 12333:44c7dfc2f6a3
bundle: make getchunk() a method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Sep 2010 18:20:34 -0500 |
parents | 680fe77ab5b8 |
children | e21fe9c5fb25 |
comparison
equal
deleted
inserted
replaced
12332:680fe77ab5b8 | 12333:44c7dfc2f6a3 |
---|---|
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 changegroup.chunkiter(bundle): | 36 for chunk in bundle.chunks(): |
37 pos = bundle.tell() | 37 pos = bundle.tell() |
38 yield chunk, pos - len(chunk) | 38 yield chunk, pos - len(chunk) |
39 n = len(self) | 39 n = len(self) |
40 prev = None | 40 prev = None |
41 for chunk, start in chunkpositer(): | 41 for chunk, start in chunkpositer(): |
224 | 224 |
225 def file(self, f): | 225 def file(self, f): |
226 if not self.bundlefilespos: | 226 if not self.bundlefilespos: |
227 self.bundle.seek(self.filestart) | 227 self.bundle.seek(self.filestart) |
228 while 1: | 228 while 1: |
229 chunk = changegroup.getchunk(self.bundle) | 229 chunk = self.bundle.chunk() |
230 if not chunk: | 230 if not chunk: |
231 break | 231 break |
232 self.bundlefilespos[chunk] = self.bundle.tell() | 232 self.bundlefilespos[chunk] = self.bundle.tell() |
233 for c in changegroup.chunkiter(self.bundle): | 233 for c in self.bundle.chunks(): |
234 pass | 234 pass |
235 | 235 |
236 if f[0] == '/': | 236 if f[0] == '/': |
237 f = f[1:] | 237 f = f[1:] |
238 if f in self.bundlefilespos: | 238 if f in self.bundlefilespos: |