changeset 8774:5de682ee0b06

repo-scan: introduce cli repo-scan options --install-git-hooks and --overwrite-git-hooks
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 20 Nov 2020 16:06:13 +0100
parents c6b4788337b5
children 8c781cb03412
files kallithea/bin/kallithea_cli_repo.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_repo.py	Fri Nov 20 16:11:55 2020 +0100
+++ b/kallithea/bin/kallithea_cli_repo.py	Fri Nov 20 16:06:13 2020 +0100
@@ -37,7 +37,11 @@
 @cli_base.register_command(config_file_initialize_app=True)
 @click.option('--remove-missing', is_flag=True,
         help='Remove missing repositories from the Kallithea database.')
-def repo_scan(remove_missing):
+@click.option('--install-git-hooks', is_flag=True,
+        help='(Re)install Kallithea Git hooks without overwriting other hooks.')
+@click.option('--overwrite-git-hooks', is_flag=True,
+        help='(Re)install Kallithea Git hooks, overwriting other hooks.')
+def repo_scan(remove_missing, install_git_hooks, overwrite_git_hooks):
     """Scan filesystem for repositories.
 
     Search the configured repository root for new repositories and add them
@@ -48,7 +52,9 @@
     """
     click.echo('Now scanning root location for new repos ...')
     added, removed = repo2db_mapper(ScmModel().repo_scan(),
-                                    remove_obsolete=remove_missing)
+                                    remove_obsolete=remove_missing,
+                                    install_git_hooks=install_git_hooks,
+                                    overwrite_git_hooks=overwrite_git_hooks)
     click.echo('Scan completed.')
     if added:
         click.echo('Added: %s' % ', '.join(added))