Patchwork [4,of,7,iterbatch] setdiscovery: use iterbatch interface instead of batch

login
register
mail settings
Submitter Augie Fackler
Date March 8, 2016, 4:25 a.m.
Message ID <daf0fd2b309cfa46fa59.1457411140@147.17.16.172.in-addr.arpa>
Download mbox | patch
Permalink /patch/13660/
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 1456872281 18000
#      Tue Mar 01 17:44:41 2016 -0500
# Node ID daf0fd2b309cfa46fa5911ed988ad2dad945e9b0
# Parent  409accaf401bbad8a3a3d1523bb455a02f6a4560
# EXP-Topic batch
setdiscovery: use iterbatch interface instead of batch

It's a little more concise, and gives us some simple test coverage.

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -147,12 +147,11 @@  def findcommonheads(ui, local, remote,
     sample = _limitsample(ownheads, initialsamplesize)
     # indices between sample and externalized version must match
     sample = list(sample)
-    batch = remote.batch()
-    srvheadhashesref = batch.heads()
-    yesnoref = batch.known(dag.externalizeall(sample))
+    batch = remote.iterbatch()
+    batch.heads()
+    batch.known(dag.externalizeall(sample))
     batch.submit()
-    srvheadhashes = srvheadhashesref.value
-    yesno = yesnoref.value
+    srvheadhashes, yesno = batch.results()
 
     if cl.tip() == nullid:
         if srvheadhashes != [nullid]: