# HG changeset patch # User Martin von Zweigbergk # Date 1532560321 25200 # Node ID f2cde417a738bfc816b61ef2f64bd0112769f5d1 # Parent 4806d1339c30567ce94d4bb26abb35ca9ba426ad builddependencies: extract function for getting successors The code no longer makes a difference between single- and mult-successor cases and just needs a set (or generator, really) of successors to iterate over. Let's extract that into a function. diff -r 4806d1339c30 -r f2cde417a738 hgext3rd/evolve/utility.py --- a/hgext3rd/evolve/utility.py Wed Jul 25 16:23:25 2018 -0700 +++ b/hgext3rd/evolve/utility.py Wed Jul 25 16:12:01 2018 -0700 @@ -96,14 +96,7 @@ for r in revs: dependencies[r] = set() for p in repo[r].parents(): - try: - succs = {_singlesuccessor(repo, p)} - except MultipleSuccessorsError as exc: - succs = set() - for successorsset in exc.successorssets: - for node in successorsset: - succs.add(repo[node].rev()) - for succ in succs: + for succ in _successorrevs(repo, p): if succ in revs: dependencies[r].add(succ) @@ -137,6 +130,14 @@ return repo[newer[0][0]].rev() +def _successorrevs(repo, ctx): + try: + return {_singlesuccessor(repo, ctx)} + except MultipleSuccessorsError as exc: + return {repo[node].rev() + for successorsset in exc.successorssets + for node in successorsset} + def revselectionprompt(ui, repo, revs, customheader=""): """function to prompt user to choose a revision from all the revs and return that revision for further tasks