Mercurial > evolve
changeset 3904:d2d03df3956f
builddependencies: build inverse dict from forward dict
It's error-prone to keep "dependencies" and "rdependencies" in sync
(we don't do it correctly when there are multiple successors or a
node). It's easier to just create "rependencies" from "dependencies"
after it's complete.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 25 Jul 2018 14:33:48 -0700 |
parents | 038cdaca7145 |
children | 4806d1339c30 |
files | hgext3rd/evolve/utility.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/utility.py Wed Jul 25 14:21:49 2018 -0700 +++ b/hgext3rd/evolve/utility.py Wed Jul 25 14:33:48 2018 -0700 @@ -92,8 +92,6 @@ # 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 = {r: set() for r in revs} for r in revs: dependencies[r] = set() @@ -111,7 +109,13 @@ continue if succ in revs: dependencies[r].add(succ) - rdependencies[succ].add(r) + + # rdependencies is the inverted dict of dependencies + rdependencies = {r: set() for r in revs} + for r, deps in dependencies.items(): + for dep in deps: + rdependencies[dep].add(r) + return dependencies, rdependencies def _singlesuccessor(repo, p):