Mercurial > hg
diff mercurial/phases.py @ 51579:87655e6dc108
phases: convert remote phase root to node while reading them
This is currently a bit silly as we will convert them back to node right after,
but that is an intermediate step before doing more disruptive changes.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 08 Apr 2024 15:11:49 +0200 |
parents | 231a92eb1936 |
children | b70628a9aa7e |
line wrap: on
line diff
--- a/mercurial/phases.py Fri Apr 05 11:17:25 2024 +0200 +++ b/mercurial/phases.py Mon Apr 08 15:11:49 2024 +0200 @@ -1105,8 +1105,9 @@ """ repo = repo.unfiltered() # build list from dictionary - draftroots = [] - has_node = repo.changelog.index.has_node # to filter unknown nodes + draft_roots = [] + to_rev = repo.changelog.index.get_rev + to_node = repo.changelog.node for nhex, phase in roots.items(): if nhex == b'publishing': # ignore data related to publish option continue @@ -1117,14 +1118,16 @@ msg = _(b'ignoring inconsistent public root from remote: %s\n') repo.ui.warn(msg % nhex) elif phase == draft: - if has_node(node): - draftroots.append(node) + rev = to_rev(node) + if rev is not None: # to filter unknown nodes + draft_roots.append(rev) else: msg = _(b'ignoring unexpected root from remote: %i %s\n') repo.ui.warn(msg % (phase, nhex)) # compute heads - publicheads = newheads(repo, subset, draftroots) - return publicheads, draftroots + draft_nodes = [to_node(r) for r in draft_roots] + publicheads = newheads(repo, subset, draft_nodes) + return publicheads, draft_nodes class remotephasessummary: