Mercurial > public > mercurial-scm > hg
comparison mercurial/phases.py @ 34816:e2c42f751b06
phase: filter out non-draft item in "draft root"
The on-disk file can contain draft root that are descendants of secret root.
The resulting phase computation is correct, but the phases root content is
not. I will send another series to introduce code that remove some of the
cases where this can happens, but we first need to damage control the existing
case.
After this changeset, we can no longer advertise secret changeset as draft
root.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 11 Oct 2017 20:08:02 +0200 |
parents | cdf833d7de98 |
children | eb6375651974 |
comparison
equal
deleted
inserted
replaced
34815:68e0bcb90357 | 34816:e2c42f751b06 |
---|---|
500 def listphases(repo): | 500 def listphases(repo): |
501 """List phases root for serialization over pushkey""" | 501 """List phases root for serialization over pushkey""" |
502 # Use ordered dictionary so behavior is deterministic. | 502 # Use ordered dictionary so behavior is deterministic. |
503 keys = util.sortdict() | 503 keys = util.sortdict() |
504 value = '%i' % draft | 504 value = '%i' % draft |
505 cl = repo.unfiltered().changelog | |
505 for root in repo._phasecache.phaseroots[draft]: | 506 for root in repo._phasecache.phaseroots[draft]: |
506 keys[hex(root)] = value | 507 if repo._phasecache.phase(repo, cl.rev(root)) <= draft: |
508 keys[hex(root)] = value | |
507 | 509 |
508 if repo.publishing(): | 510 if repo.publishing(): |
509 # Add an extra data to let remote know we are a publishing | 511 # Add an extra data to let remote know we are a publishing |
510 # repo. Publishing repo can't just pretend they are old repo. | 512 # repo. Publishing repo can't just pretend they are old repo. |
511 # When pushing to a publishing repo, the client still need to | 513 # When pushing to a publishing repo, the client still need to |