Patchwork [07,of,24] discovery: process heads in sorted order

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 16, 2012, 10:34 p.m.
Message ID <4cf320954987b2fdc24f.1355697242@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/131/
State Accepted
Commit 06f07583601055654d4235ad71fa7f3cb5e5e827
Headers show

Comments

Mads Kiilerich - Dec. 16, 2012, 10:34 p.m.
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1355687456 -3600
# Node ID 4cf320954987b2fdc24f2327cc12758f9a3a04f4
# Parent  e35343a104ac1c3e20629f90a6c59e09d4337093
discovery: process heads in sorted order
Bryan O'Sullivan - Dec. 17, 2012, 8:58 p.m.
On Sun, Dec 16, 2012 at 2:34 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> discovery: process heads in sorted order
>

Looks good, but the purpose of switching from iteritems to items is again
lost on me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/311921df/attachment.html>

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -266,7 +266,7 @@ 
     allmissing = set(outgoing.missing)
     allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common))
     allfuturecommon.update(allmissing)
-    for branch, heads in headssum.iteritems():
+    for branch, heads in sorted(headssum.items()):
         if heads[0] is None:
             # Maybe we should abort if we push more that one head
             # for new branches ?
@@ -310,7 +310,7 @@ 
             unsynced = True
         if len(newhs) > len(oldhs):
             # strip updates to existing remote heads from the new heads list
-            dhs = list(newhs - bookmarkedheads - oldhs)
+            dhs = sorted(newhs - bookmarkedheads - oldhs)
         if dhs:
             if error is None:
                 if branch not in ('default', None):
diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t
--- a/tests/test-push-warn.t
+++ b/tests/test-push-warn.t
@@ -457,7 +457,7 @@ 
   $ hg push ../l -b b
   pushing to ../l
   searching for changes
-  abort: push creates new remote head e7e31d71180f on branch 'a'!
+  abort: push creates new remote head 451211cc22b0 on branch 'a'!
   (did you forget to merge? use push -f to force)
   [255]