From f216c88680a880db75ab24d9ce8fa35f327ac697 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Thu, 30 Apr 2020 19:51:21 -0300 Subject: Restore merge-configs functionality For backwards compatibility. However, this is deprecated, and shouldn't be used on new deployments. It'll be removed in the future. The new config system has built-in support for external repo lists. --- ganarchy/cli/merge_configs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 ganarchy/cli/merge_configs.py (limited to 'ganarchy/cli') diff --git a/ganarchy/cli/merge_configs.py b/ganarchy/cli/merge_configs.py new file mode 100644 index 0000000..d8e12e6 --- /dev/null +++ b/ganarchy/cli/merge_configs.py @@ -0,0 +1,25 @@ +import pathlib + +import click + +import ganarchy +import ganarchy.cli +import ganarchy.data + +@ganarchy.cli.main.command() +@click.option('--skip-errors/--no-skip-errors', default=False) +@click.argument('files', type=click.Path(exists=True, dir_okay=False, resolve_path=True), nargs=-1) +def merge_configs(skip_errors, files): + """Merges config files.""" + configs = [ganarchy.data.LocalDataSource(filename) for filename in files] + rlm = ganarchy.data.RepoListManager(ganarchy.data.ObjectDataSource({})) + rlm.sources += configs + res = [] + for src in rlm.sources: + res.append(src.update()) + effective = ganarchy.data.EffectiveSource(rlm) + if any(x is None for x in res): + click.echo("# This is DEPRECATED and will be REMOVED at some point!") + for pctp in effective.get_property_values(ganarchy.data.DataProperty.VCS_REPOS): + if pctp.active: + click.echo(f"""projects."{ganarchy.tomlescape(pctp.project_commit)}"."{ganarchy.tomlescape(pctp.uri)}"."{ganarchy.tomlescape(pctp.branch)}" = {{ active=true }}""") -- cgit 1.4.1