changeset 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 68e0bcb90357
children a80142b03552
files mercurial/phases.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Sun Oct 15 22:48:02 2017 -0400
+++ b/mercurial/phases.py	Wed Oct 11 20:08:02 2017 +0200
@@ -502,8 +502,10 @@
     # Use ordered dictionary so behavior is deterministic.
     keys = util.sortdict()
     value = '%i' % draft
+    cl = repo.unfiltered().changelog
     for root in repo._phasecache.phaseroots[draft]:
-        keys[hex(root)] = value
+        if repo._phasecache.phase(repo, cl.rev(root)) <= draft:
+            keys[hex(root)] = value
 
     if repo.publishing():
         # Add an extra data to let remote know we are a publishing