changeset 8742:94a21c71df91

hooks: always use the right repo size hook - don't rely on the value in the database
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 03 Nov 2020 12:45:29 +0100
parents 9b7c5d7ad1a2
children 50906cedb924
files kallithea/lib/db_manage.py kallithea/lib/utils.py
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/db_manage.py	Mon Nov 02 14:07:16 2020 +0100
+++ b/kallithea/lib/db_manage.py	Tue Nov 03 12:45:29 2020 +0100
@@ -245,7 +245,7 @@
             ('paths', '/', repo_root_path, True),
             #('phases', 'publish', 'false', False)
             ('hooks', db.Ui.HOOK_UPDATE, 'hg update >&2', False),
-            ('hooks', db.Ui.HOOK_REPO_SIZE, 'python:kallithea.lib.hooks.repo_size', True),
+            ('hooks', db.Ui.HOOK_REPO_SIZE, 'python:', True),  # the actual value doesn't matter
             ('extensions', 'largefiles', '', True),
             ('largefiles', 'usercache', os.path.join(repo_root_path, '.cache', 'largefiles'), True),
             ('extensions', 'hggit', '', False),
--- a/kallithea/lib/utils.py	Mon Nov 02 14:07:16 2020 +0100
+++ b/kallithea/lib/utils.py	Tue Nov 03 12:45:29 2020 +0100
@@ -335,6 +335,8 @@
     # push / pull hooks
     baseui.setconfig(b'hooks', b'changegroup.kallithea_log_push_action', b'python:kallithea.lib.hooks.log_push_action')
     baseui.setconfig(b'hooks', b'outgoing.kallithea_log_pull_action', b'python:kallithea.lib.hooks.log_pull_action')
+    if baseui.config(b'hooks', ascii_bytes(db.Ui.HOOK_REPO_SIZE)):  # ignore actual value
+        baseui.setconfig(b'hooks', ascii_bytes(db.Ui.HOOK_REPO_SIZE), b'python:kallithea.lib.hooks.repo_size')
 
     if repo_path is not None:
         # Note: MercurialRepository / mercurial.localrepo.instance will do this too, so it will always be possible to override db settings or what is hardcoded above