# HG changeset patch # User Mads Kiilerich # Date 1604712581 -3600 # Node ID f8971422795e0476dda0aaa5ece9e46e092968fd # Parent 0a84ef075575de51735b975d178befd1ea6434a7 scripts: introduce source_format.py to fix up the module name in file headers diff -r 0a84ef075575 -r f8971422795e kallithea/bin/vcs_hooks.py --- a/kallithea/bin/vcs_hooks.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/bin/vcs_hooks.py Sat Nov 07 02:29:41 2020 +0100 @@ -13,7 +13,7 @@ # along with this program. If not, see . """ kallithea.bin.vcs_hooks -~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~ Entry points for Kallithea hooking into Mercurial and Git. diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/https_fixup.py --- a/kallithea/config/middleware/https_fixup.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/https_fixup.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.https_fixup -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.https_fixup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ middleware to handle https correctly diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/permanent_repo_url.py --- a/kallithea/config/middleware/permanent_repo_url.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/permanent_repo_url.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.permanent_repo_url -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.permanent_repo_url +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ middleware to handle permanent repo URLs, replacing PATH_INFO '/_123/yada' with '/name/of/repo/yada' after looking 123 up in the database. diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/pygrack.py --- a/kallithea/config/middleware/pygrack.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/pygrack.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.pygrack -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.pygrack +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Python implementation of git-http-backend's Smart HTTP protocol diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/simplegit.py --- a/kallithea/config/middleware/simplegit.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/simplegit.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.simplegit -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.simplegit +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SimpleGit middleware for handling Git protocol requests (push/clone etc.) It's implemented with basic auth function diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/simplehg.py --- a/kallithea/config/middleware/simplehg.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/simplehg.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.simplehg -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.simplehg +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SimpleHg middleware for handling Mercurial protocol requests (push/clone etc.). It's implemented with basic auth function diff -r 0a84ef075575 -r f8971422795e kallithea/config/middleware/wrapper.py --- a/kallithea/config/middleware/wrapper.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/config/middleware/wrapper.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.lib.middleware.wrapper -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +kallithea.config.middleware.wrapper +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Wrap app to measure request and response time ... all the way to the response WSGI iterator has been closed. diff -r 0a84ef075575 -r f8971422795e kallithea/lib/conf.py --- a/kallithea/lib/conf.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/lib/conf.py Sat Nov 07 02:29:41 2020 +0100 @@ -13,7 +13,7 @@ # along with this program. If not, see . """ kallithea.lib.conf -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~ Various config settings for Kallithea diff -r 0a84ef075575 -r f8971422795e kallithea/lib/webutils.py --- a/kallithea/lib/webutils.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/lib/webutils.py Sat Nov 07 02:29:41 2020 +0100 @@ -13,7 +13,7 @@ # along with this program. If not, see . """ kallithea.lib.webutils -~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~ Helper functions that may rely on the current WSGI request, exposed in the TG2 thread-local "global" variables. It should have few dependencies so it can be diff -r 0a84ef075575 -r f8971422795e kallithea/model/userlog.py --- a/kallithea/model/userlog.py Sun Oct 11 10:13:25 2020 +0200 +++ b/kallithea/model/userlog.py Sat Nov 07 02:29:41 2020 +0100 @@ -12,8 +12,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ -kallithea.model.db -~~~~~~~~~~~~~~~~~~ +kallithea.model.userlog +~~~~~~~~~~~~~~~~~~~~~~~ Database Models for Kallithea diff -r 0a84ef075575 -r f8971422795e scripts/run-all-cleanup --- a/scripts/run-all-cleanup Sun Oct 11 10:13:25 2020 +0200 +++ b/scripts/run-all-cleanup Sat Nov 07 02:29:41 2020 +0100 @@ -8,6 +8,7 @@ scripts/docs-headings.py scripts/generate-ini.py scripts/whitespacecleanup.sh +hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/pyflakes echo "no blocking problems found by $0" diff -r 0a84ef075575 -r f8971422795e scripts/source_format.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/source_format.py Sat Nov 07 02:29:41 2020 +0100 @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py + +import re +import sys + + +filenames = sys.argv[1:] + +for fn in filenames: + with open(fn) as f: + org_content = f.read() + + mod_name = fn[:-3] if fn.endswith('.py') else fn + mod_name = mod_name[:-9] if mod_name.endswith('/__init__') else mod_name + mod_name = mod_name.replace('/', '.') + def f(m): + return '"""\n%s\n%s\n' % (mod_name, '~' * len(mod_name)) + new_content = re.sub(r'^"""\n(kallithea\..*\n)(~+\n)?', f, org_content, count=1, flags=re.MULTILINE) + + if new_content != org_content: + with open(fn, 'w') as f: + f.write(new_content)