Mercurial > hg
comparison mercurial/localrepo.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 | 336ec75ed1ac |
children | 21893ff382cd |
comparison
equal
deleted
inserted
replaced
44449:ff72bd52d56a | 44452:9d2b2df2c2ba |
---|---|
1807 # quo fine? | 1807 # quo fine? |
1808 | 1808 |
1809 # map tag name to (node, hist) | 1809 # map tag name to (node, hist) |
1810 alltags = tagsmod.findglobaltags(self.ui, self) | 1810 alltags = tagsmod.findglobaltags(self.ui, self) |
1811 # map tag name to tag type | 1811 # map tag name to tag type |
1812 tagtypes = dict((tag, b'global') for tag in alltags) | 1812 tagtypes = {tag: b'global' for tag in alltags} |
1813 | 1813 |
1814 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) | 1814 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) |
1815 | 1815 |
1816 # Build the return dicts. Have to re-encode tag names because | 1816 # Build the return dicts. Have to re-encode tag names because |
1817 # the tags module always uses UTF-8 (in order not to lose info | 1817 # the tags module always uses UTF-8 (in order not to lose info |
1820 tags = {} | 1820 tags = {} |
1821 for (name, (node, hist)) in pycompat.iteritems(alltags): | 1821 for (name, (node, hist)) in pycompat.iteritems(alltags): |
1822 if node != nullid: | 1822 if node != nullid: |
1823 tags[encoding.tolocal(name)] = node | 1823 tags[encoding.tolocal(name)] = node |
1824 tags[b'tip'] = self.changelog.tip() | 1824 tags[b'tip'] = self.changelog.tip() |
1825 tagtypes = dict( | 1825 tagtypes = { |
1826 [ | 1826 encoding.tolocal(name): value |
1827 (encoding.tolocal(name), value) | 1827 for (name, value) in pycompat.iteritems(tagtypes) |
1828 for (name, value) in pycompat.iteritems(tagtypes) | 1828 } |
1829 ] | |
1830 ) | |
1831 return (tags, tagtypes) | 1829 return (tags, tagtypes) |
1832 | 1830 |
1833 def tagtype(self, tagname): | 1831 def tagtype(self, tagname): |
1834 ''' | 1832 ''' |
1835 return the type of the given tag. result can be: | 1833 return the type of the given tag. result can be: |