This instance will be upgraded to Heptapod 0.23.2 on 2021-08-05 at 11:00 UTC+2 (a few minutes of down time)

Commit 38e465b1 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

topic: copy current implementation of builddependencies() from evolve

parent 648c9ac1fa9c
Pipeline #14282 failed with stage
in 5 minutes and 7 seconds
import collections
from mercurial import (
......@@ -23,20 +21,20 @@ def builddependencies(repo, revs):
# dependencies = {3: [6], 6:[]}
# Means that: 6 has no dependency, 3 depends on 6 to be solved
dependencies = {}
# rdependencies is the inverted dict of dependencies
rdependencies = collections.defaultdict(set)
for r in revs:
dependencies[r] = set()
for p in repo[r].parents():
succ = _singlesuccessor(repo, p)
except MultipleSuccessorsError as exc:
dependencies[r] = exc.successorssets
if succ in revs:
for succ in _successorrevs(repo, p):
if succ in revs:
# rdependencies is the inverted dict of dependencies
rdependencies = {r: set() for r in revs}
for r, deps in dependencies.items():
for dep in deps:
return dependencies, rdependencies
def _singlesuccessor(repo, p):
......@@ -57,15 +55,23 @@ def _singlesuccessor(repo, p):
obs = obs.p1()
newer = obsutil.successorssets(repo, obs.node(), cache=cache)
if 1 < len(newer):
if len(newer) > 1:
# divergence case
# we should pick as arbitrary one
raise MultipleSuccessorsError(newer)
elif 1 < len(newer[0]):
elif len(newer[0]) > 1:
splitheads = list(repo.revs(b'heads(%ln::%ln)', newer[0], newer[0]))
if 1 < len(splitheads):
if len(splitheads) > 1:
# split case, See if we can make sense of it.
raise MultipleSuccessorsError(newer)
return splitheads[0]
return repo[newer[0][0]].rev()
def _successorrevs(repo, ctx):
return {_singlesuccessor(repo, ctx)}
except MultipleSuccessorsError as exc:
return {repo[node].rev()
for successorsset in exc.successorssets
for node in successorsset}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment