Mercurial > hg
diff tests/svnxml.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 7c54357be2ae |
children | 7525e77b5eac |
line wrap: on
line diff
--- a/tests/svnxml.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/svnxml.py Sun Oct 06 09:45:02 2019 -0400 @@ -5,10 +5,10 @@ import sys import xml.dom.minidom + def xmltext(e): - return ''.join(c.data for c - in e.childNodes - if c.nodeType == c.TEXT_NODE) + return ''.join(c.data for c in e.childNodes if c.nodeType == c.TEXT_NODE) + def parseentry(entry): e = {} @@ -27,6 +27,7 @@ e['paths'].append((path, action, frompath, fromrev)) return e + def parselog(data): entries = [] doc = xml.dom.minidom.parseString(data) @@ -34,6 +35,7 @@ entries.append(parseentry(e)) return entries + def printentries(entries): try: fp = sys.stdout.buffer @@ -49,8 +51,8 @@ p = b' %s %s%s\n' % (action, path, frominfo) fp.write(p) + if __name__ == '__main__': data = sys.stdin.read() entries = parselog(data) printentries(entries) -