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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jun 3 04:06:29 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.

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"))


More information about the Mercurial-devel mailing list