comparison mercurial/revset.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 8561ad49915d
children 482a6aac1f15
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
1873 def parents(repo, subset, x): 1873 def parents(repo, subset, x):
1874 """ 1874 """
1875 The set of all parents for all changesets in set, or the working directory. 1875 The set of all parents for all changesets in set, or the working directory.
1876 """ 1876 """
1877 if x is None: 1877 if x is None:
1878 ps = set(p.rev() for p in repo[x].parents()) 1878 ps = {p.rev() for p in repo[x].parents()}
1879 else: 1879 else:
1880 ps = set() 1880 ps = set()
1881 cl = repo.changelog 1881 cl = repo.changelog
1882 up = ps.update 1882 up = ps.update
1883 parentrevs = cl.parentrevs 1883 parentrevs = cl.parentrevs
2435 filtering. 2435 filtering.
2436 """ 2436 """
2437 cl = repo.unfiltered().changelog 2437 cl = repo.unfiltered().changelog
2438 torev = cl.index.get_rev 2438 torev = cl.index.get_rev
2439 tonode = cl.node 2439 tonode = cl.node
2440 result = set(torev(n) for n in f(tonode(r) for r in s)) 2440 result = {torev(n) for n in f(tonode(r) for r in s)}
2441 result.discard(None) 2441 result.discard(None)
2442 return smartset.baseset(result - repo.changelog.filteredrevs) 2442 return smartset.baseset(result - repo.changelog.filteredrevs)
2443 2443
2444 2444
2445 @predicate(b'successors(set)', safe=True) 2445 @predicate(b'successors(set)', safe=True)