Mercurial > public > mercurial-scm > hg
diff mercurial/phases.py @ 44452: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 | ab41dad7345e |
children | fdc802f29b2c |
line wrap: on
line diff
--- a/mercurial/phases.py Fri Mar 06 10:52:44 2020 +0100 +++ b/mercurial/phases.py Fri Mar 06 13:27:41 2020 -0500 @@ -445,10 +445,10 @@ phasetracking, r, self.phase(repo, r), targetphase ) - roots = set( + roots = { ctx.node() for ctx in repo.set(b'roots((%ln::) - %ld)', olds, affected) - ) + } if olds != roots: self._updateroots(phase, roots, tr) # some roots may need to be declared for lower phases @@ -518,9 +518,7 @@ ] updatedroots = repo.set(b'roots(%ln::)', aboveroots) - finalroots = set( - n for n in currentroots if repo[n].rev() < minnewroot - ) + finalroots = {n for n in currentroots if repo[n].rev() < minnewroot} finalroots.update(ctx.node() for ctx in updatedroots) if finalroots != oldroots: self._updateroots(targetphase, finalroots, tr) @@ -760,7 +758,7 @@ if not heads or heads == [nullid]: return [] # The logic operated on revisions, convert arguments early for convenience - new_heads = set(rev(n) for n in heads if n != nullid) + new_heads = {rev(n) for n in heads if n != nullid} roots = [rev(n) for n in roots] # compute the area we need to remove affected_zone = repo.revs(b"(%ld::%ld)", roots, new_heads)