# HG changeset patch # User Martin von Zweigbergk # Date 1532561005 25200 # Node ID 4806d1339c30567ce94d4bb26abb35ca9ba426ad # Parent d2d03df3956f52e8651ce31f22489bf9d7d1d7da builddependencies: share code between single- and multi-successor cases The two cases now have more similar structure ("if succ in revs: dependencies[r].add(succ)"), so let's share the code so it doesn't start drifting apart again. diff -r d2d03df3956f -r 4806d1339c30 hgext3rd/evolve/utility.py --- a/hgext3rd/evolve/utility.py Wed Jul 25 14:33:48 2018 -0700 +++ b/hgext3rd/evolve/utility.py Wed Jul 25 16:23:25 2018 -0700 @@ -97,18 +97,15 @@ dependencies[r] = set() for p in repo[r].parents(): try: - succ = _singlesuccessor(repo, p) + succs = {_singlesuccessor(repo, p)} except MultipleSuccessorsError as exc: - tset = set() + succs = set() for successorsset in exc.successorssets: for node in successorsset: - succ = repo[node].rev() - if succ in revs: - tset.add(succ) - dependencies[r].update(tset) - continue - if succ in revs: - dependencies[r].add(succ) + succs.add(repo[node].rev()) + for succ in succs: + if succ in revs: + dependencies[r].add(succ) # rdependencies is the inverted dict of dependencies rdependencies = {r: set() for r in revs}