changeset 3905:4806d1339c30

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 25 Jul 2018 16:23:25 -0700
parents d2d03df3956f
children f2cde417a738
files hgext3rd/evolve/utility.py
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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}