[PATCH 4 of 6 V2] checkheads: don't warn about unsynced changes that we are going to obsolete

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Aug 25 23:54:04 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1345933664 -7200
# Node ID 5bdfa3af04ef6f84de29d8c929d68b3e1e0ca579
# Parent  fe7c99a51d2973f2a7e21f7c2441f279db722efa
checkheads: don't warn about unsynced changes that we are going to obsolete

We won't be able to pull them after this push.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -271,19 +271,19 @@
             # 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 are several cases this case does not handle
+            # XXX properly
             #
             # (1) if <nh> is public, it won't be affected by obsolete marker
             #     and a new is created
@@ -300,11 +300,14 @@
                 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)
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
@@ -267,7 +267,6 @@
   $ hg push --traceback
   pushing to $TESTTMP/remote
   searching for changes
-  note: unsynced remote changes!
   adding changesets
   adding manifests
   adding file changes



More information about the Mercurial-devel mailing list