Patchwork [6,of,7] checkheads: drop now unused filtering of 'unsyncedheads'

login
register
mail settings
Submitter Pierre-Yves David
Date June 3, 2017, 8:06 a.m.
Message ID <e3c199932c9c84037a05.1496477189@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21152/
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 1496028098 -7200
#      Mon May 29 05:21:38 2017 +0200
# Node ID e3c199932c9c84037a05ffe817838a5a4bd6f5a8
# Parent  a1f391628a0df5d08309493544874c4e1c937a9e
# 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 e3c199932c9c
checkheads: drop now unused filtering of 'unsyncedheads'

Now that unsynced heads are no longer in the function inputs or returns, we can
simplify the code a bit.

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -355,16 +355,15 @@  def checkheads(pushop):
                                                          allfuturecommon,
                                                          newheads)
         newhs.update(unsyncedheads)
-        unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
-        if unsynced:
-            if None in unsynced:
+        if unsyncedheads:
+            if None in unsyncedheads:
                 # old remote, no heads data
                 heads = None
-            elif len(unsynced) <= 4 or repo.ui.verbose:
-                heads = ' '.join(short(h) for h in unsynced)
+            elif len(unsyncedheads) <= 4 or repo.ui.verbose:
+                heads = ' '.join(short(h) for h in unsyncedheads)
             else:
-                heads = (' '.join(short(h) for h in unsynced[:4]) +
-                         ' ' + _("and %s others") % (len(unsynced) - 4))
+                heads = (' '.join(short(h) for h in unsyncedheads[:4]) +
+                         ' ' + _("and %s others") % (len(unsyncedheads) - 4))
             if heads is None:
                 repo.ui.status(_("remote has heads that are "
                                  "not known locally\n"))