From patchwork Tue Mar 8 04:25:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6,of,7,iterbatch] largefiles: use iterbatch instead of batch From: Augie Fackler X-Patchwork-Id: 13662 Message-Id: <484a8853c4ada5e028fa.1457411142@147.17.16.172.in-addr.arpa> To: mercurial-devel@mercurial-scm.org Date: Mon, 07 Mar 2016 23:25:42 -0500 # HG changeset patch # User Augie Fackler # Date 1456942385 18000 # Wed Mar 02 13:13:05 2016 -0500 # Node ID 484a8853c4ada5e028fa74920932d4ad5290e6be # Parent 645ef49fe63b02b76111ca3064d8e512de89692d # EXP-Topic batch largefiles: use iterbatch instead of batch This actually makes the code a little cleaner to read. diff --git a/hgext/largefiles/wirestore.py b/hgext/largefiles/wirestore.py --- a/hgext/largefiles/wirestore.py +++ b/hgext/largefiles/wirestore.py @@ -29,12 +29,9 @@ class wirestore(remotestore.remotestore) '''For each hash, return 0 if it is available, other values if not. It is usually 2 if the largefile is missing, but might be 1 the server has a corrupted copy.''' - batch = self.remote.batch() + batch = self.remote.iterbatch() futures = {} for hash in hashes: - futures[hash] = batch.statlfile(hash) + batch.statlfile(hash) batch.submit() - retval = {} - for hash in hashes: - retval[hash] = futures[hash].value - return retval + return dict(zip(hashes, batch.results()))