# HG changeset patch # User Augie Fackler # Date 1470416990 14400 # Node ID ac5f6b11aa9149900e445b2bd7f896e89171bc83 # Parent 0839c8d34d7876c776da0317f3e6882ee3b041a6 bundlerevlog: 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. diff -r 0839c8d34d78 -r ac5f6b11aa91 mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Fri Aug 05 13:09:24 2016 -0400 +++ b/mercurial/bundlerepo.py Fri Aug 05 13:09:50 2016 -0400 @@ -56,10 +56,8 @@ self.repotiprev = n - 1 chain = None self.bundlerevs = set() # used by 'bundle()' revset expression - while True: - chunkdata = bundle.deltachunk(chain) - if not chunkdata: - break + getchunk = lambda: bundle.deltachunk(chain) + for chunkdata in iter(getchunk, {}): node = chunkdata['node'] p1 = chunkdata['p1'] p2 = chunkdata['p2']