diff mercurial/discovery.py @ 15713:cff25e4b37d2

phases: do not exchange secret changesets Any secret changesets will be excluded from pull and push. Phase data are properly synchronized on pull and push if a changeset is seen as secret locally but is non-secret remote side. This patch does not handle the case of a changeset secret on remote but known locally.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2011 00:42:25 +0100
parents 646759147717
children cd956049fc14
line wrap: on
line diff
--- a/mercurial/discovery.py	Thu Dec 22 00:40:46 2011 +0100
+++ b/mercurial/discovery.py	Thu Dec 22 00:42:25 2011 +0100
@@ -85,12 +85,28 @@
     _common, inc, remoteheads = commoninc
 
     cl = repo.changelog
-    outg = cl.findmissing(common, revs)
+    alloutg = cl.findmissing(common, revs)
+    outg = []
+    secret = []
+    for o in alloutg:
+        if repo[o].phase() >= 2:
+            secret.append(o)
+        else:
+            outg.append(o)
 
     if not outg:
-        repo.ui.status(_("no changes found\n"))
+        if secret:
+            repo.ui.status(_("no changes to push but %i secret changesets\n")
+                           % len(secret))
+        else:
+            repo.ui.status(_("no changes found\n"))
         return None, 1, common
 
+    if secret:
+        # recompute target revs
+        revs = [ctx.node() for ctx in repo.set('heads(::(%ld))',
+                                               map(repo.changelog.rev, outg))]
+
     if not force and remoteheads != [nullid]:
         if remote.capable('branchmap'):
             # Check for each named branch if we're creating new remote heads.