Patchwork [3,of,7] discovery: also use lists for the returns of '_oldheadssummary'

login
register
mail settings
Submitter Pierre-Yves David
Date June 3, 2017, 8:06 a.m.
Message ID <3f9771a8f079d5698213.1496477186@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21149/
State Accepted
Headers show

Comments

Pierre-Yves David - June 3, 2017, 8:06 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1496029039 -7200
#      Mon May 29 05:37:19 2017 +0200
# Node ID 3f9771a8f079d5698213d2038c077007ca4f3c5b
# Parent  51b40d37c34613eeb7c98904b931ba8ddcc6df2f
# EXP-Topic pushrace
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 3f9771a8f079
discovery: also use lists for the returns of '_oldheadssummary'

The '_headssummary' function is documenting and using list objects in its
return.  We now use them in _oldheadssummary too for consistency. This does not
affect any usages of these values.

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -244,7 +244,7 @@  def _oldheadssummary(repo, remoteheads, 
     # Construct {old,new}map with branch = None (topological branch).
     # (code based on update)
     knownnode = repo.changelog.hasnode # no nodemap until it is filtered
-    oldheads = set(h for h in remoteheads if knownnode(h))
+    oldheads = list(h for h in remoteheads if knownnode(h))
     # all nodes in outgoing.missing are children of either:
     # - an element of oldheads
     # - another element of outgoing.missing
@@ -254,9 +254,9 @@  def _oldheadssummary(repo, remoteheads, 
     newheads = list(c.node() for c in r)
     # set some unsynced head to issue the "unsynced changes" warning
     if inc:
-        unsynced = {None}
+        unsynced = [None]
     else:
-        unsynced = set()
+        unsynced = []
     return {None: (oldheads, newheads, unsynced)}
 
 def _nowarnheads(pushop):