Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/graphmod.py @ 44470:9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Built with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens
and then blackened. pyupgrade comes from
https://github.com/asottile/pyupgrade with a patch to let me preserve
extraneous parens (which we use for marking strings that shouldn't be
translated), and lets us clean up a bunch of idioms that have cruftily
accumulated over the years.
# skip-blame no-op automated code cleanups
Differential Revision: https://phab.mercurial-scm.org/D8255
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Mar 2020 13:27:41 -0500 |
parents | faa8a59f4a06 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
44469:ff72bd52d56a | 44470:9d2b2df2c2ba |
---|---|
56 for rev in revs: | 56 for rev in revs: |
57 ctx = repo[rev] | 57 ctx = repo[rev] |
58 # partition into parents in the rev set and missing parents, then | 58 # partition into parents in the rev set and missing parents, then |
59 # augment the lists with markers, to inform graph drawing code about | 59 # augment the lists with markers, to inform graph drawing code about |
60 # what kind of edge to draw between nodes. | 60 # what kind of edge to draw between nodes. |
61 pset = set(p.rev() for p in ctx.parents() if p.rev() in revs) | 61 pset = {p.rev() for p in ctx.parents() if p.rev() in revs} |
62 mpars = [ | 62 mpars = [ |
63 p.rev() | 63 p.rev() |
64 for p in ctx.parents() | 64 for p in ctx.parents() |
65 if p.rev() != nullrev and p.rev() not in pset | 65 if p.rev() != nullrev and p.rev() not in pset |
66 ] | 66 ] |
93 that are in nodes, too. | 93 that are in nodes, too. |
94 """ | 94 """ |
95 include = set(nodes) | 95 include = set(nodes) |
96 for node in nodes: | 96 for node in nodes: |
97 ctx = repo[node] | 97 ctx = repo[node] |
98 parents = set( | 98 parents = { |
99 (PARENT, p.rev()) for p in ctx.parents() if p.node() in include | 99 (PARENT, p.rev()) for p in ctx.parents() if p.node() in include |
100 ) | 100 } |
101 yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) | 101 yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) |
102 | 102 |
103 | 103 |
104 def colored(dag, repo): | 104 def colored(dag, repo): |
105 """annotates a DAG with colored edge information | 105 """annotates a DAG with colored edge information |