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

Augie Fackler raf at durin42.com
Mon Mar 7 23:25:40 EST 2016


# HG changeset patch
# User Augie Fackler <augie at 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.

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]:


More information about the Mercurial-devel mailing list