##// END OF EJS Templates
Make bundlerepo lazier...
Brendan Cully -
r5262:a3575638 default
parent child Browse files
Show More
@@ -193,18 +193,19 b' class bundlerepository(localrepo.localre'
193 else:
193 else:
194 raise util.Abort(_("%s: unknown bundle compression type")
194 raise util.Abort(_("%s: unknown bundle compression type")
195 % bundlename)
195 % bundlename)
196 self.changelog = bundlechangelog(self.sopener, self.bundlefile)
197 self.manifest = bundlemanifest(self.sopener, self.bundlefile,
198 self.changelog.rev)
199 # dict with the mapping 'filename' -> position in the bundle
196 # dict with the mapping 'filename' -> position in the bundle
200 self.bundlefilespos = {}
197 self.bundlefilespos = {}
201 while 1:
198
202 f = changegroup.getchunk(self.bundlefile)
199 def __getattr__(self, name):
203 if not f:
200 if name == 'changelog':
204 break
201 self.changelog = bundlechangelog(self.sopener, self.bundlefile)
205 self.bundlefilespos[f] = self.bundlefile.tell()
202 return self.changelog
206 for c in changegroup.chunkiter(self.bundlefile):
203 if name == 'manifest':
207 pass
204 self.manifest = bundlemanifest(self.sopener, self.bundlefile,
205 self.changelog.rev)
206 self.filestart = self.bundlefile.tell()
207 return self.manifest
208 return localrepo.localrepository.__getattr__(self, name)
208
209
209 def url(self):
210 def url(self):
210 return self._url
211 return self._url
@@ -213,6 +214,17 b' class bundlerepository(localrepo.localre'
213 return -1
214 return -1
214
215
215 def file(self, f):
216 def file(self, f):
217 if not self.bundlefilespos:
218 self.manifest
219 self.bundlefile.seek(self.filestart)
220 while 1:
221 chunk = changegroup.getchunk(self.bundlefile)
222 if not chunk:
223 break
224 self.bundlefilespos[chunk] = self.bundlefile.tell()
225 for c in changegroup.chunkiter(self.bundlefile):
226 pass
227
216 if f[0] == '/':
228 if f[0] == '/':
217 f = f[1:]
229 f = f[1:]
218 if f in self.bundlefilespos:
230 if f in self.bundlefilespos:
General Comments 0
You need to be logged in to leave comments. Login now