comparison mercurial/wireproto.py @ 16532:9eba72cdde34 stable

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 26 Apr 2012 03:47:17 +0200
parents 6097ede2be4d
children 39d1f83eb05d
comparison
equal deleted inserted replaced
16531:b9f51f49bf2a 16532:9eba72cdde34
553 553
554 def unbundle(repo, proto, heads): 554 def unbundle(repo, proto, heads):
555 their_heads = decodelist(heads) 555 their_heads = decodelist(heads)
556 556
557 def check_heads(): 557 def check_heads():
558 heads = repo.heads() 558 heads = phases.visibleheads(repo)
559 heads_hash = util.sha1(''.join(sorted(heads))).digest() 559 heads_hash = util.sha1(''.join(sorted(heads))).digest()
560 return (their_heads == ['force'] or their_heads == heads or 560 return (their_heads == ['force'] or their_heads == heads or
561 their_heads == ['hashed', heads_hash]) 561 their_heads == ['hashed', heads_hash])
562 562
563 proto.redirect() 563 proto.redirect()