[PATCH STABLE] wireprotocol: use visibleheads as reference while unbundling (issue 3303)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Apr 25 20:50:41 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1335404837 -7200
# Branch stable
# Node ID d5b723eef8a5c7d08a40ad0a861f7bee6f069225
# Parent  cfaeb9318f834d8d8b9fbb8eb6085c09de234391
wireprotocol: use visibleheads as reference while unbundling (issue 3303)

The `repo` object here is *always* local. Using `repo.heads()` ensure we will
reject push if any secret changeset exists.

During discovery, `visibleheads` were sent to the peer. So we can only expect it
to send us `visibleheads` back. If any secret changeset exists::

    visibleheads != repo.heads()

This fix server side part of issue 3303 when pushing over the wire.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -555,7 +555,7 @@
     their_heads = decodelist(heads)
 
     def check_heads():
-        heads = repo.heads()
+        heads = phases.visibleheads(repo)
         heads_hash = util.sha1(''.join(sorted(heads))).digest()
         return (their_heads == ['force'] or their_heads == heads or
                 their_heads == ['hashed', heads_hash])


More information about the Mercurial-devel mailing list