# HG changeset patch # User Martin von Zweigbergk # Date 1532554428 25200 # Node ID d2d03df3956f52e8651ce31f22489bf9d7d1d7da # Parent 038cdaca714580f45f61a6845c8a9304f999d6a5 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. diff -r 038cdaca7145 -r d2d03df3956f hgext3rd/evolve/utility.py --- 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):