[PATCH] discovery: fix regression when checking heads for pre 1.4 client (issue3218)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jan 25 16:07:58 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1327430970 -3600
# Branch stable
# Node ID 9f483a763bc98436e60b7a65223255aac1848ea5
# Parent  894f83a356534652e76da4008987a3e570a23cc0
discovery: fix regression when checking heads for pre 1.4 client (issue3218)

This code is not run by the test suite and silly name error were lurking here.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -131,7 +131,7 @@
 
     return og
 
-def checkheads(repo, remote, outgoing, remoteheads, newbranch=False):
+def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False):
     """Check that a push won't add any outgoing head
 
     raise Abort error and display ui message as needed.
@@ -190,9 +190,9 @@
         # Construct {old,new}map with branch = None (topological branch).
         # (code based on _updatebranchcache)
         oldheads = set(h for h in remoteheads if h in cl.nodemap)
-        newheads = oldheads.union(outg)
+        newheads = oldheads.union(outgoing.missing)
         if len(newheads) > 1:
-            for latest in reversed(outg):
+            for latest in reversed(outgoing.missing):
                 if latest not in newheads:
                     continue
                 minhrev = min(cl.rev(h) for h in newheads)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1635,7 +1635,8 @@
                     # something to push
                     if not force:
                         discovery.checkheads(self, remote, outgoing,
-                                             remoteheads, newbranch)
+                                             remoteheads, newbranch,
+                                             bool(inc))
 
                     # create a changegroup from local
                     if revs is None and not outgoing.excluded:


More information about the Mercurial-devel mailing list