Mercurial > kallithea
view scripts/logformat.py @ 7464:12455b1a1a6f
front-end: Use select2 from node_modules and stop bundling it
select2 3.5.4 was added in 304e83e9bcde ... but the latest npm release in the 3
series is 3.5.1, so we use that one instead. We should probably upgrade to the
4 series.
The select2 images were not in the location the generated css pointed - now we
copy them from node_modules to the right location, next to the generated css.
Note: this will drop 190cb30841de "branches: fix performance of branch
selectors with many branches - only show the first 200 results" ... but it
should no longer be relevant now when we use server side filtering.
15e507047bae introduced select2-bootstrap.css - it is not clear what version
was used, but we use the latest 1.4.6 which also is very old.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 11 Dec 2018 01:22:56 +0100 |
parents | 665dfa112f2c |
children | 4473f1094d3d |
line wrap: on
line source
#!/usr/bin/env python2 import re import sys if len(sys.argv) < 2: print 'Cleanup of superfluous % formatting of log statements.' print 'Usage:' print ''' hg revert `hg loc '*.py'|grep -v logformat.py` && scripts/logformat.py `hg loc '*.py'` && hg diff''' raise SystemExit(1) logre = r''' (log\.(?:error|info|warning|debug) [(][ \n]* ) %s ( [ \n]*[)] ) ''' res = [ # handle % () - keeping spaces around the old % (re.compile(logre % r'''("[^"]*"|'[^']*') ([\n ]*) % ([\n ]*) \( ( (?:[^()]|\n)* (?: \( (?:[^()]|\n)* \) (?:[^()]|\n)* )* ) \) ''', flags=re.MULTILINE|re.VERBOSE), r'\1\2,\3\4\5\6'), # handle % without () - keeping spaces around the old % (re.compile(logre % r'''("[^"]*"|'[^']*') ([\n ]*) % ([\n ]*) ( (?:[^()]|\n)* (?: \( (?:[^()]|\n)* \) (?:[^()]|\n)* )* ) ''', flags=re.MULTILINE|re.VERBOSE), r'\1\2,\3\4\5\6'), # remove extra space if it is on next line (re.compile(logre % r'''("[^"]*"|'[^']*') , (\n [ ]) ([ ][\n ]*) ( (?:[^()]|\n)* (?: \( (?:[^()]|\n)* \) (?:[^()]|\n)* )* ) ''', flags=re.MULTILINE|re.VERBOSE), r'\1\2,\3\4\5\6'), # remove extra space if it is on same line (re.compile(logre % r'''("[^"]*"|'[^']*') , [ ]+ () ( [\n ]+) ( (?:[^()]|\n)* (?: \( (?:[^()]|\n)* \) (?:[^()]|\n)* )* ) ''', flags=re.MULTILINE|re.VERBOSE), r'\1\2,\3\4\5\6'), # remove trailing , and space (re.compile(logre % r'''("[^"]*"|'[^']*') , () ( [\n ]*) ( (?:[^()]|\n)* (?: \( (?:[^()]|\n)* \) (?:[^()]|\n)* )* [^(), \n] ) [ ,]*''', flags=re.MULTILINE|re.VERBOSE), r'\1\2,\3\4\5\6'), ] for f in sys.argv[1:]: s = open(f).read() for r, t in res: s = r.sub(t, s) open(f, 'w').write(s)