[PATCH 4 of 6 STABLE] checkheads: don't warns about unsynched changes that we are going to obsolete

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Aug 1 12:55:44 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1343842300 -7200
# Branch stable
# Node ID 9d3f983b25c784574a27e5975a266da24984268c
# Parent  8e7740959ac3b22ae653f790b6a5f4602f95fbb4
checkheads: don't warns about unsynched changes that we are going to obsolete.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -269,23 +269,23 @@ def checkheads(repo, remote, outgoing, r
     for branch, heads in headssum.iteritems():
         if heads[0] is None:
             # Maybe we should abort if we push more that one head
             # for new branches ?
             continue
-        if heads[2]:
-            unsynced = True
-        oldhs = set(heads[0])
         candidate_newhs = set(heads[1])
         # add unsynced data
+        oldhs = set(heads[0])
         oldhs.update(heads[2])
         candidate_newhs.update(heads[2])
         dhs = None
+        discardedheads = set()
         if repo.obsstore:
             # remove future heads which are actually obsolete by another
             # pushed element:
             #
-            # XXX There is several case this case does not handle properly
+            # XXX as above, There is several case this case does not handle
+            #               properly
             #
             # (1) if <nh> is public, it won't be affected by obsolete marker
             #     and a new is created
             #
             # (2) if the new heads have ancestors which are not obsolete and
@@ -298,15 +298,18 @@ def checkheads(repo, remote, outgoing, r
                 if nh in repo and repo[nh].phase() == phases.public:
                     newhs.add(nh)
                 else:
                     for suc in obsolete.anysuccessors(repo.obsstore, nh):
                         if suc != nh and suc in allfuturecommon:
+                            discardedheads.add(nh)
                             break
                     else:
                         newhs.add(nh)
         else:
             newhs = candidate_newhs
+        if [h for h in heads[2] if h not in discardedheads]:
+            unsynced = True
         if len(newhs) > len(oldhs):
             # strip updates to existing remote heads from the new heads list
             dhs = list(newhs - bookmarkedheads - oldhs)
         if dhs:
             if error is None:
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -265,10 +265,9 @@ It should not complains about "unsynced 
 handled yet.
 
   $ hg push --traceback
   pushing to $TESTTMP/remote
   searching for changes
-  note: unsynced remote changes!
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)


More information about the Mercurial-devel mailing list