Show More
@@ -190,7 +190,12 b' def findcommonoutgoing(' | |||||
190 | if len(missing) == len(allmissing): |
|
190 | if len(missing) == len(allmissing): | |
191 | ancestorsof = onlyheads |
|
191 | ancestorsof = onlyheads | |
192 | else: # update missing heads |
|
192 | else: # update missing heads | |
193 | ancestorsof = phases.newheads(repo, onlyheads, excluded) |
|
193 | to_rev = repo.changelog.index.rev | |
|
194 | to_node = repo.changelog.node | |||
|
195 | excluded_revs = [to_rev(r) for r in excluded] | |||
|
196 | onlyheads_revs = [to_rev(r) for r in onlyheads] | |||
|
197 | new_heads = phases.new_heads(repo, onlyheads_revs, excluded_revs) | |||
|
198 | ancestorsof = [to_node(r) for r in new_heads] | |||
194 | og.ancestorsof = ancestorsof |
|
199 | og.ancestorsof = ancestorsof | |
195 | if portable: |
|
200 | if portable: | |
196 | # recompute common and ancestorsof as if -r<rev> had been given for |
|
201 | # recompute common and ancestorsof as if -r<rev> had been given for |
@@ -109,6 +109,7 b' import weakref' | |||||
109 | from typing import ( |
|
109 | from typing import ( | |
110 | Any, |
|
110 | Any, | |
111 | Callable, |
|
111 | Callable, | |
|
112 | Collection, | |||
112 | Dict, |
|
113 | Dict, | |
113 | Iterable, |
|
114 | Iterable, | |
114 | List, |
|
115 | List, | |
@@ -127,7 +128,6 b' from .node import (' | |||||
127 | ) |
|
128 | ) | |
128 | from . import ( |
|
129 | from . import ( | |
129 | error, |
|
130 | error, | |
130 | pycompat, |
|
|||
131 | requirements, |
|
131 | requirements, | |
132 | smartset, |
|
132 | smartset, | |
133 | txnutil, |
|
133 | txnutil, | |
@@ -1125,9 +1125,11 b' def analyzeremotephases(repo, subset, ro' | |||||
1125 | msg = _(b'ignoring unexpected root from remote: %i %s\n') |
|
1125 | msg = _(b'ignoring unexpected root from remote: %i %s\n') | |
1126 | repo.ui.warn(msg % (phase, nhex)) |
|
1126 | repo.ui.warn(msg % (phase, nhex)) | |
1127 | # compute heads |
|
1127 | # compute heads | |
|
1128 | subset_revs = [to_rev(n) for n in subset] | |||
|
1129 | public_heads = new_heads(repo, subset_revs, draft_roots) | |||
1128 | draft_nodes = [to_node(r) for r in draft_roots] |
|
1130 | draft_nodes = [to_node(r) for r in draft_roots] | |
1129 | publicheads = newheads(repo, subset, draft_nodes) |
|
1131 | public_nodes = [to_node(r) for r in public_heads] | |
1130 |
return public |
|
1132 | return public_nodes, draft_nodes | |
1131 |
|
1133 | |||
1132 |
|
1134 | |||
1133 | class remotephasessummary: |
|
1135 | class remotephasessummary: | |
@@ -1152,7 +1154,11 b' class remotephasessummary:' | |||||
1152 | self.draftheads = [c.node() for c in dheads] |
|
1154 | self.draftheads = [c.node() for c in dheads] | |
1153 |
|
1155 | |||
1154 |
|
1156 | |||
1155 | def newheads(repo, heads, roots): |
|
1157 | def new_heads( | |
|
1158 | repo, | |||
|
1159 | heads: Collection[int], | |||
|
1160 | roots: Collection[int], | |||
|
1161 | ) -> Collection[int]: | |||
1156 | """compute new head of a subset minus another |
|
1162 | """compute new head of a subset minus another | |
1157 |
|
1163 | |||
1158 | * `heads`: define the first subset |
|
1164 | * `heads`: define the first subset | |
@@ -1161,16 +1167,15 b' def newheads(repo, heads, roots):' | |||||
1161 | # phases > dagop > patch > copies > scmutil > obsolete > obsutil > phases |
|
1167 | # phases > dagop > patch > copies > scmutil > obsolete > obsutil > phases | |
1162 | from . import dagop |
|
1168 | from . import dagop | |
1163 |
|
1169 | |||
1164 | repo = repo.unfiltered() |
|
|||
1165 | cl = repo.changelog |
|
|||
1166 | rev = cl.index.get_rev |
|
|||
1167 | if not roots: |
|
1170 | if not roots: | |
1168 | return heads |
|
1171 | return heads | |
1169 |
if not heads or heads == [ |
|
1172 | if not heads or heads == [nullrev]: | |
1170 | return [] |
|
1173 | return [] | |
1171 | # The logic operated on revisions, convert arguments early for convenience |
|
1174 | # The logic operated on revisions, convert arguments early for convenience | |
1172 | new_heads = {rev(n) for n in heads if n != repo.nullid} |
|
1175 | # PERF-XXX: maybe heads could directly comes as a set without impacting | |
1173 | roots = [rev(n) for n in roots] |
|
1176 | # other user of that value | |
|
1177 | new_heads = set(heads) | |||
|
1178 | new_heads.discard(nullrev) | |||
1174 | # compute the area we need to remove |
|
1179 | # compute the area we need to remove | |
1175 | affected_zone = repo.revs(b"(%ld::%ld)", roots, new_heads) |
|
1180 | affected_zone = repo.revs(b"(%ld::%ld)", roots, new_heads) | |
1176 | # heads in the area are no longer heads |
|
1181 | # heads in the area are no longer heads | |
@@ -1188,7 +1193,9 b' def newheads(repo, heads, roots):' | |||||
1188 | pruned = dagop.reachableroots(repo, candidates, prunestart) |
|
1193 | pruned = dagop.reachableroots(repo, candidates, prunestart) | |
1189 | new_heads.difference_update(pruned) |
|
1194 | new_heads.difference_update(pruned) | |
1190 |
|
1195 | |||
1191 | return pycompat.maplist(cl.node, sorted(new_heads)) |
|
1196 | # PERF-XXX: do we actually need a sorted list here? Could we simply return | |
|
1197 | # a set? | |||
|
1198 | return sorted(new_heads) | |||
1192 |
|
1199 | |||
1193 |
|
1200 | |||
1194 | def newcommitphase(ui: "uimod.ui") -> int: |
|
1201 | def newcommitphase(ui: "uimod.ui") -> int: |
General Comments 0
You need to be logged in to leave comments.
Login now