Mercurial > hg
diff hgext/phabricator.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 | 09f3e003fc2a |
children | bbb170f9396d |
line wrap: on
line diff
--- a/hgext/phabricator.py Fri Mar 06 10:52:44 2020 +0100 +++ b/hgext/phabricator.py Fri Mar 06 13:27:41 2020 -0500 @@ -483,7 +483,7 @@ ] # "precursors" as known by Phabricator - phprecset = set(getnode(d) for d in diffs) + phprecset = {getnode(d) for d in diffs} # Ignore if precursors (Phabricator and local repo) do not overlap, # and force is not set (when commit message says nothing) @@ -1062,7 +1062,7 @@ # username not found is not an error of the API. So check if we have missed # some names here. data = result[b'data'] - resolved = set(entry[b'fields'][b'username'].lower() for entry in data) + resolved = {entry[b'fields'][b'username'].lower() for entry in data} unresolved = set(names) - resolved if unresolved: raise error.Abort( @@ -1635,7 +1635,7 @@ "differential.query". """ # Prefetch hg:meta property for all diffs - diffids = sorted(set(max(int(v) for v in drev[b'diffs']) for drev in drevs)) + diffids = sorted({max(int(v) for v in drev[b'diffs']) for drev in drevs}) diffs = callconduit(ui, b'differential.querydiffs', {b'ids': diffids}) patches = [] @@ -1792,11 +1792,11 @@ """Phabricator differiential status""" revs = repo.revs('sort(_underway(), topo)') drevmap = getdrevmap(repo, revs) - unknownrevs, drevids, revsbydrevid = [], set([]), {} + unknownrevs, drevids, revsbydrevid = [], set(), {} for rev, drevid in pycompat.iteritems(drevmap): if drevid is not None: drevids.add(drevid) - revsbydrevid.setdefault(drevid, set([])).add(rev) + revsbydrevid.setdefault(drevid, set()).add(rev) else: unknownrevs.append(rev)