How to use the vcstool.commands.custom.CustomCommand function in vcstool

To help you get started, we’ve selected a few vcstool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dirk-thomas / vcstool / vcstool / commands / custom.py View on Github external
args = parser.parse_args(args[0:index])
    args.args = client_args

    # check if any client type is specified
    any_client_type = False
    for client in vcstool_clients:
        if client.type in args and args.__dict__[client.type]:
            any_client_type = True
            break
    # if no client type is specified enable all client types
    if not any_client_type:
        for client in vcstool_clients:
            if client.type in args:
                args.__dict__[client.type] = True

    command = CustomCommand(args)

    # filter repositories by specified client types
    clients = find_repositories(command.paths, nested=command.nested)
    clients = [c for c in clients if c.type in args and args.__dict__[c.type]]

    if command.output_repos:
        output_repositories(clients)
    jobs = generate_jobs(clients, command)
    results = execute_jobs(
        jobs, show_progress=True, number_of_workers=args.workers,
        debug_jobs=args.debug)

    output_results(results, hide_empty=args.hide_empty)

    any_error = any(r['returncode'] for r in results)
    return 1 if any_error else 0
github dirk-thomas / vcstool / vcstool / commands / __init__.py View on Github external
from .branch import BranchCommand
from .custom import CustomCommand
from .diff import DiffCommand
from .export import ExportCommand
from .import_ import ImportCommand
from .log import LogCommand
from .pull import PullCommand
from .push import PushCommand
from .remotes import RemotesCommand
from .status import StatusCommand
from .validate import ValidateCommand

vcstool_commands = []
vcstool_commands.append(BranchCommand)
vcstool_commands.append(CustomCommand)
vcstool_commands.append(DiffCommand)
vcstool_commands.append(ExportCommand)
vcstool_commands.append(ImportCommand)
vcstool_commands.append(LogCommand)
vcstool_commands.append(PullCommand)
vcstool_commands.append(PushCommand)
vcstool_commands.append(RemotesCommand)
vcstool_commands.append(StatusCommand)
vcstool_commands.append(ValidateCommand)

_commands = [c.command for c in vcstool_commands]
if len(_commands) != len(set(_commands)):
    raise RuntimeError(
        'Multiple commands share the same command name: ' +
        ', '.join(sorted(_commands)))
github dirk-thomas / vcstool / vcstool / commands / custom.py View on Github external
def __init__(self, args):
        super(CustomCommand, self).__init__(args)
        self.args = args.args