Mercurial > public > mercurial-scm > hg
diff mercurial/phases.py @ 15892:592b3d1742a1
phases: simplify phase exchange and movement over pushkey
The code now only exchange draft root and only care about movement related to
public//draft boundary.
There is multiple reason to simplify this code:
* Secret are never discovered anymore
* We decided to not support more the three existing phase
Removing phase index from pushkey (if ever decided) will be made in another commit.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 13 Jan 2012 02:04:16 +0100 |
parents | e3ee8bf5d0cc |
children | 4252d9f08d7e |
line wrap: on
line diff
--- a/mercurial/phases.py Fri Jan 13 01:42:47 2012 +0100 +++ b/mercurial/phases.py Fri Jan 13 02:04:16 2012 +0100 @@ -203,9 +203,10 @@ def listphases(repo): """List phases root for serialisation over pushkey""" keys = {} - for phase in trackedphases: - for root in repo._phaseroots[phase]: - keys[hex(root)] = '%i' % phase + value = '%i' % draft + for root in repo._phaseroots[draft]: + keys[hex(root)] = value + if repo.ui.configbool('phases', 'publish', True): # Add an extra data to let remote know we are a publishing repo. # Publishing repo can't just pretend they are old repo. When pushing to @@ -264,20 +265,26 @@ Accept unknown element input """ # build list from dictionary - phaseroots = [[] for p in allphases] + draftroots = [] + nm = repo.changelog.nodemap # to filter unknown node for nhex, phase in roots.iteritems(): if nhex == 'publishing': # ignore data related to publish option continue node = bin(nhex) phase = int(phase) - if node in repo: - phaseroots[phase].append(node) + if phase == 0: + if node != nullid: + msg = _('ignoring inconsistense public root from remote: %s') + repo.ui.warn(msg, nhex) + elif phase == 1: + if node in nm: + draftroots.append(node) + else: + msg = _('ignoring unexpected root from remote: %i %s') + repo.ui.warn(msg, phase, nhex) # compute heads - phaseheads = [[] for p in allphases] - for phase in allphases[:-1]: - toproof = phaseroots[phase + 1] - revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))', - subset, toproof, toproof, subset) - phaseheads[phase].extend(c.node() for c in revset) - return phaseheads, phaseroots + revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))', + subset, draftroots, draftroots, subset) + publicheads = [c.node() for c in revset] + return publicheads, draftroots