Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
51578:231a92eb1936 | 51579:87655e6dc108 |
---|---|
1103 | 1103 |
1104 Accept unknown element input | 1104 Accept unknown element input |
1105 """ | 1105 """ |
1106 repo = repo.unfiltered() | 1106 repo = repo.unfiltered() |
1107 # build list from dictionary | 1107 # build list from dictionary |
1108 draftroots = [] | 1108 draft_roots = [] |
1109 has_node = repo.changelog.index.has_node # to filter unknown nodes | 1109 to_rev = repo.changelog.index.get_rev |
1110 to_node = repo.changelog.node | |
1110 for nhex, phase in roots.items(): | 1111 for nhex, phase in roots.items(): |
1111 if nhex == b'publishing': # ignore data related to publish option | 1112 if nhex == b'publishing': # ignore data related to publish option |
1112 continue | 1113 continue |
1113 node = bin(nhex) | 1114 node = bin(nhex) |
1114 phase = int(phase) | 1115 phase = int(phase) |
1115 if phase == public: | 1116 if phase == public: |
1116 if node != repo.nullid: | 1117 if node != repo.nullid: |
1117 msg = _(b'ignoring inconsistent public root from remote: %s\n') | 1118 msg = _(b'ignoring inconsistent public root from remote: %s\n') |
1118 repo.ui.warn(msg % nhex) | 1119 repo.ui.warn(msg % nhex) |
1119 elif phase == draft: | 1120 elif phase == draft: |
1120 if has_node(node): | 1121 rev = to_rev(node) |
1121 draftroots.append(node) | 1122 if rev is not None: # to filter unknown nodes |
1123 draft_roots.append(rev) | |
1122 else: | 1124 else: |
1123 msg = _(b'ignoring unexpected root from remote: %i %s\n') | 1125 msg = _(b'ignoring unexpected root from remote: %i %s\n') |
1124 repo.ui.warn(msg % (phase, nhex)) | 1126 repo.ui.warn(msg % (phase, nhex)) |
1125 # compute heads | 1127 # compute heads |
1126 publicheads = newheads(repo, subset, draftroots) | 1128 draft_nodes = [to_node(r) for r in draft_roots] |
1127 return publicheads, draftroots | 1129 publicheads = newheads(repo, subset, draft_nodes) |
1130 return publicheads, draft_nodes | |
1128 | 1131 |
1129 | 1132 |
1130 class remotephasessummary: | 1133 class remotephasessummary: |
1131 """summarize phase information on the remote side | 1134 """summarize phase information on the remote side |
1132 | 1135 |