Mercurial > kallithea
changeset 7499:a188803df37e
scripts: docs-headings: improve performance by grouping 'hg diff' invocations
With SSD, this change reduces the execution time of this script from 8 to
0.5 seconds
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 30 Dec 2018 11:45:28 +0100 |
parents | e7d6373631c4 |
children | ddee465a345a |
files | scripts/docs-headings.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/docs-headings.py Fri Dec 28 21:56:52 2018 +0100 +++ b/scripts/docs-headings.py Sun Dec 30 11:45:28 2018 +0100 @@ -30,8 +30,9 @@ def main(): - for fn in subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines(): - print 'processing %s:' % fn + filenames = subprocess.check_output(['hg', 'loc', 'set:**.rst+kallithea/i18n/how_to']).splitlines() + for fn in filenames: + print 'processing %s' % fn s = open(fn).read() # find levels and their styles @@ -72,8 +73,8 @@ s = re.sub(r'''\n+((?:\.\. _[^\n]*\n)+)$''', r'\n\n\n\1', s) open(fn, 'w').write(s) - print subprocess.check_output(['hg', 'diff', fn]) - print + + print subprocess.check_output(['hg', 'diff'] + filenames) if __name__ == '__main__': main()