Patchwork [6,of,7,iterbatch] largefiles: use iterbatch instead of batch

login
register
mail settings
Submitter Augie Fackler
Date March 8, 2016, 4:25 a.m.
Message ID <484a8853c4ada5e028fa.1457411142@147.17.16.172.in-addr.arpa>
Download mbox | patch
Permalink /patch/13662/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Augie Fackler - March 8, 2016, 4:25 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# 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.
Pierre-Yves David - March 10, 2016, 2:55 p.m.
On 03/08/2016 04:25 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # 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.

Patch 3-6 are on the clowncopter.

Patch 7 is a whole new set of non-trivial thing and will get attention 
later.

Cheers,

Patch

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()))