# HG changeset patch # User Pierre-Yves David # Date 2017-05-29 03:33:59 # Node ID 315d74d0f059bb26dd23f2329a51c9dd44cb6518 # Parent 81cbfaea1e0f4957ad3b154d249fb0bd6e2e575a headssummary: ensure all returned lists are sorted This is a simple step that will help to keep a stable output in coming refactoring. diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -235,6 +235,10 @@ def _headssummary(repo, remote, outgoing newmap.update(repo, (ctx.rev() for ctx in missingctx)) for branch, newheads in newmap.iteritems(): headssum[branch][1][:] = newheads + for branch, items in headssum.iteritems(): + for l in items: + if l is not None: + l.sort() return headssum def _oldheadssummary(repo, remoteheads, outgoing, inc=False): @@ -244,14 +248,14 @@ 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 = list(h for h in remoteheads if knownnode(h)) + oldheads = sorted(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 # - nullrev # This explains why the new head are very simple to compute. r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing) - newheads = list(c.node() for c in r) + newheads = sorted(c.node() for c in r) # set some unsynced head to issue the "unsynced changes" warning if inc: unsynced = [None]