largefiles: use iterbatch instead of batch
authorAugie Fackler <augie@google.com>
Wed, 02 Mar 2016 13:13:05 -0500
changeset 28439 b6e71f8af5b8
parent 28438 48fd02dac1d4
child 28440 855d9b2eea67
largefiles: use iterbatch instead of batch This actually makes the code a little cleaner to read.
hgext/largefiles/wirestore.py
--- a/hgext/largefiles/wirestore.py	Tue Mar 01 18:41:43 2016 -0500
+++ b/hgext/largefiles/wirestore.py	Wed Mar 02 13:13:05 2016 -0500
@@ -29,12 +29,8 @@
         '''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()
-        futures = {}
+        batch = self.remote.iterbatch()
         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()))