comparison mercurial/bundlerepo.py @ 29710:0839c8d34d78

bundlerepo: use for loop over iterator instead of while True The iter() builtin has a neat pattern where you give it a callable of no arguments and a sentinel value, and you can then loop over the function calls like a normal iterator. This cleans up the code a little.
author Augie Fackler <augie@google.com>
date Fri, 05 Aug 2016 13:09:24 -0400
parents 39537bc64442
children ac5f6b11aa91
comparison
equal deleted inserted replaced
29709:b9ee2a1c4e9c 29710:0839c8d34d78
349 return self._url 349 return self._url
350 350
351 def file(self, f): 351 def file(self, f):
352 if not self.bundlefilespos: 352 if not self.bundlefilespos:
353 self.bundle.seek(self.filestart) 353 self.bundle.seek(self.filestart)
354 while True: 354 for chunkdata in iter(self.bundle.filelogheader, {}):
355 chunkdata = self.bundle.filelogheader()
356 if not chunkdata:
357 break
358 fname = chunkdata['filename'] 355 fname = chunkdata['filename']
359 self.bundlefilespos[fname] = self.bundle.tell() 356 self.bundlefilespos[fname] = self.bundle.tell()
360 while True: 357 while True:
361 c = self.bundle.deltachunk(None) 358 c = self.bundle.deltachunk(None)
362 if not c: 359 if not c: