comparison mercurial/branchmap.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 89a2afe31e82
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
444 # if older branchheads are reachable from new ones, they aren't 444 # if older branchheads are reachable from new ones, they aren't
445 # really branchheads. Note checking parents is insufficient: 445 # really branchheads. Note checking parents is insufficient:
446 # 1 (branch a) -> 2 (branch b) -> 3 (branch a) 446 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
447 for branch, newheadrevs in pycompat.iteritems(newbranches): 447 for branch, newheadrevs in pycompat.iteritems(newbranches):
448 bheads = self._entries.setdefault(branch, []) 448 bheads = self._entries.setdefault(branch, [])
449 bheadset = set(cl.rev(node) for node in bheads) 449 bheadset = {cl.rev(node) for node in bheads}
450 450
451 # This have been tested True on all internal usage of this function. 451 # This have been tested True on all internal usage of this function.
452 # run it again in case of doubt 452 # run it again in case of doubt
453 # assert not (set(bheadrevs) & set(newheadrevs)) 453 # assert not (set(bheadrevs) & set(newheadrevs))
454 bheadset.update(newheadrevs) 454 bheadset.update(newheadrevs)
580 self._rbcrevs = bytearray(self._rbcrevslen * _rbcrecsize) 580 self._rbcrevs = bytearray(self._rbcrevslen * _rbcrecsize)
581 util.clearcachedproperty(self, b'_namesreverse') 581 util.clearcachedproperty(self, b'_namesreverse')
582 582
583 @util.propertycache 583 @util.propertycache
584 def _namesreverse(self): 584 def _namesreverse(self):
585 return dict((b, r) for r, b in enumerate(self._names)) 585 return {b: r for r, b in enumerate(self._names)}
586 586
587 def branchinfo(self, rev): 587 def branchinfo(self, rev):
588 """Return branch name and close flag for rev, using and updating 588 """Return branch name and close flag for rev, using and updating
589 persistent cache.""" 589 persistent cache."""
590 changelog = self._repo.changelog 590 changelog = self._repo.changelog