Mercurial > hg
comparison mercurial/discovery.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 | a0ec05d93c8e |
children | a08bbdf839ae |
comparison
equal
deleted
inserted
replaced
44449:ff72bd52d56a | 44452:9d2b2df2c2ba |
---|---|
186 # recompute common and missingheads as if -r<rev> had been given for | 186 # recompute common and missingheads as if -r<rev> had been given for |
187 # each head of missing, and --base <rev> for each head of the proper | 187 # each head of missing, and --base <rev> for each head of the proper |
188 # ancestors of missing | 188 # ancestors of missing |
189 og._computecommonmissing() | 189 og._computecommonmissing() |
190 cl = repo.changelog | 190 cl = repo.changelog |
191 missingrevs = set(cl.rev(n) for n in og._missing) | 191 missingrevs = {cl.rev(n) for n in og._missing} |
192 og._common = set(cl.ancestors(missingrevs)) - missingrevs | 192 og._common = set(cl.ancestors(missingrevs)) - missingrevs |
193 commonheads = set(og.commonheads) | 193 commonheads = set(og.commonheads) |
194 og.missingheads = [h for h in og.missingheads if h not in commonheads] | 194 og.missingheads = [h for h in og.missingheads if h not in commonheads] |
195 | 195 |
196 return og | 196 return og |
262 headssum[branch] = items + ([],) | 262 headssum[branch] = items + ([],) |
263 | 263 |
264 # If there are no obsstore, no post processing are needed. | 264 # If there are no obsstore, no post processing are needed. |
265 if repo.obsstore: | 265 if repo.obsstore: |
266 torev = repo.changelog.rev | 266 torev = repo.changelog.rev |
267 futureheads = set(torev(h) for h in outgoing.missingheads) | 267 futureheads = {torev(h) for h in outgoing.missingheads} |
268 futureheads |= set(torev(h) for h in outgoing.commonheads) | 268 futureheads |= {torev(h) for h in outgoing.commonheads} |
269 allfuturecommon = repo.changelog.ancestors(futureheads, inclusive=True) | 269 allfuturecommon = repo.changelog.ancestors(futureheads, inclusive=True) |
270 for branch, heads in sorted(pycompat.iteritems(headssum)): | 270 for branch, heads in sorted(pycompat.iteritems(headssum)): |
271 remoteheads, newheads, unsyncedheads, placeholder = heads | 271 remoteheads, newheads, unsyncedheads, placeholder = heads |
272 result = _postprocessobsolete(pushop, allfuturecommon, newheads) | 272 result = _postprocessobsolete(pushop, allfuturecommon, newheads) |
273 headssum[branch] = ( | 273 headssum[branch] = ( |