changegroup: use `iter(callable, sentinel)` instead of while True
This is functionally equivalent, but is a little more concise.
--- a/mercurial/changegroup.py Wed Jul 27 21:44:49 2016 +0900
+++ b/mercurial/changegroup.py Fri Aug 05 13:59:58 2016 -0400
@@ -475,10 +475,7 @@
def _unpackmanifests(self, repo, revmap, trp, prog, numchanges):
super(cg3unpacker, self)._unpackmanifests(repo, revmap, trp, prog,
numchanges)
- while True:
- chunkdata = self.filelogheader()
- if not chunkdata:
- break
+ for chunkdata in iter(self.filelogheader, {}):
# If we get here, there are directory manifests in the changegroup
d = chunkdata["filename"]
repo.ui.debug("adding %s revisions\n" % d)
@@ -1012,10 +1009,7 @@
def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
revisions = 0
files = 0
- while True:
- chunkdata = source.filelogheader()
- if not chunkdata:
- break
+ for chunkdata in iter(source.filelogheader, {}):
files += 1
f = chunkdata["filename"]
repo.ui.debug("adding %s revisions\n" % f)