Changeset - 5de682ee0b06
[Not reviewed]
default
0 1 0
Mads Kiilerich (mads) - 5 years ago 2020-11-20 16:06:13
mads@kiilerich.com
Grafted from: 899712c8e8df
repo-scan: introduce cli repo-scan options --install-git-hooks and --overwrite-git-hooks
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_repo.py
Show inline comments
 
@@ -34,24 +34,30 @@ from kallithea.model import db, meta
 
from kallithea.model.scm import ScmModel
 

	
 

	
 
@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
 
    into Kallithea.
 
    Additionally, report repositories that were previously known to Kallithea
 
    but are no longer present on the filesystem. If option --remove-missing is
 
    given, remove the missing repositories from the Kallithea database.
 
    """
 
    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))
 
    if removed:
 
        click.echo('%s: %s' % ('Removed' if remove_missing else 'Missing',
 
                          ', '.join(removed)))
0 comments (0 inline, 0 general)