# HG changeset patch # User Augie Fackler # Date 1470420008 14400 # Node ID cbeb2cb578b14f3ac893f75d544f1e0d1c814308 # Parent 4e7be6e3326903f77be0f605a269e42aaf19bf42 commands: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise. diff -r 4e7be6e33269 -r cbeb2cb578b1 mercurial/commands.py --- a/mercurial/commands.py Fri Aug 05 13:59:58 2016 -0400 +++ b/mercurial/commands.py Fri Aug 05 14:00:08 2016 -0400 @@ -2102,10 +2102,7 @@ def showchunks(named): ui.write("\n%s%s\n" % (indent_string, named)) chain = None - while True: - chunkdata = gen.deltachunk(chain) - if not chunkdata: - break + for chunkdata in iter(lambda: gen.deltachunk(chain), {}): node = chunkdata['node'] p1 = chunkdata['p1'] p2 = chunkdata['p2'] @@ -2121,10 +2118,7 @@ showchunks("changelog") chunkdata = gen.manifestheader() showchunks("manifest") - while True: - chunkdata = gen.filelogheader() - if not chunkdata: - break + for chunkdata in iter(gen.filelogheader, {}): fname = chunkdata['filename'] showchunks(fname) else: @@ -2132,10 +2126,7 @@ raise error.Abort(_('use debugbundle2 for this file')) chunkdata = gen.changelogheader() chain = None - while True: - chunkdata = gen.deltachunk(chain) - if not chunkdata: - break + for chunkdata in iter(lambda: gen.deltachunk(chain), {}): node = chunkdata['node'] ui.write("%s%s\n" % (indent_string, hex(node))) chain = node