[PATCH 2 of 4] discovery: introduce an optional remoteheads attribute on outgoing object

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jan 13 15:58:15 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1326490230 -3600
# Node ID 7f2d2a5ceb19de2cfa76d766fc62c02c60f0a637
# Parent  c435f190d8f12ee07e6b36f0335fb167ac9e8d3a
discovery: introduce an optional remoteheads attribute on outgoing object

The outgoing object aims is to ease exchange discovery related data between
call stack.  The remote heads are computed by commoninc so having findcommon
outgoing storing this data in such object make sense.

It's optional because it is not use by the object itself. Moreover, other code
creating discovery.outgoing object may not have this knowledge (for example,
bundle)

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -57,13 +57,15 @@
       excluded is the list of missing changeset that shouldn't be sent remotely.
       missingheads is the list of heads of missing.
       commonheads is the list of heads of common.
+      remoteheads is the list of remote heads (optional).
 
     The sets are computed on demand from the heads, unless provided upfront
     by discovery.'''
 
-    def __init__(self, revlog, commonheads, missingheads):
+    def __init__(self, revlog, commonheads, missingheads, remoteheads=None):
         self.commonheads = commonheads
         self.missingheads = missingheads
+        self.remoteheads = remoteheads
         self._revlog = revlog
         self._common = None
         self._missing = None
@@ -102,7 +104,7 @@
     # get common set if not provided
     if commoninc is None:
         commoninc = findcommonincoming(repo, other, force=force)
-    og.commonheads, _any, _hds = commoninc
+    og.commonheads, _any, og.remoteheads = commoninc
 
     # compute outgoing
     if not repo._phaseroots[phases.secret]:


More information about the Mercurial-devel mailing list