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.
--- 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}