How to use the vcstool.commands.command.Command 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 / remotes.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class RemotesCommand(Command):

    command = 'remotes'
    help = 'Show the URL of the repository'

    def __init__(self, args):
        super(RemotesCommand, self).__init__(args)


def get_parser():
    parser = argparse.ArgumentParser(
        description='Show the URL of the repository', prog='vcs remotes')
    parser.add_argument_group('"remotes" command parameters')
    return parser


def main(args=None, stdout=None, stderr=None):
github dirk-thomas / vcstool / vcstool / commands / export.py View on Github external
import os
import sys

from vcstool.crawler import find_repositories
from vcstool.executor import ansi
from vcstool.executor import execute_jobs
from vcstool.executor import generate_jobs
from vcstool.executor import output_repositories
from vcstool.executor import output_results
from vcstool.streams import set_streams

from .command import add_common_arguments
from .command import Command


class ExportCommand(Command):

    command = 'export'
    help = 'Export the list of repositories'

    def __init__(self, args):
        super(ExportCommand, self).__init__(args)
        self.exact = args.exact


def get_parser():
    parser = argparse.ArgumentParser(
        description='Export the list of repositories', prog='vcs export')
    group = parser.add_argument_group('"export" command parameters')
    group.add_argument(
        '--exact', action='store_true', default=False,
        help='Export exact commit hash instead of branch names')
github dirk-thomas / vcstool / vcstool / commands / custom.py View on Github external
import argparse
import sys

from vcstool.clients import vcstool_clients
from vcstool.crawler import find_repositories
from vcstool.executor import execute_jobs
from vcstool.executor import generate_jobs
from vcstool.executor import output_repositories
from vcstool.executor import output_results
from vcstool.streams import set_streams

from .command import add_common_arguments
from .command import Command


class CustomCommand(Command):

    command = 'custom'
    help = 'Run a custom command'

    def __init__(self, args):
        super(CustomCommand, self).__init__(args)
        self.args = args.args


def get_parser():
    parser = argparse.ArgumentParser(
        description='Run a custom command', prog='vcs custom')
    group = parser.add_argument_group(
        '"custom" command parameters restricting the repositories')
    for client_type in [
        c.type for c in vcstool_clients if c.type not in ['tar']
github dirk-thomas / vcstool / vcstool / commands / push.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class PushCommand(Command):

    command = 'push'
    help = 'Push changes from the working copy to the repository'

    def __init__(self, args):
        super(PushCommand, self).__init__(args)


def get_parser():
    parser = argparse.ArgumentParser(
        description='Push changes from the working copy to the repository',
        prog='vcs push')
    parser.add_argument_group('"push" command parameters')
    return parser
github dirk-thomas / vcstool / vcstool / commands / import_.py View on Github external
import os
import sys

from vcstool.clients import vcstool_clients
from vcstool.executor import ansi
from vcstool.executor import execute_jobs
from vcstool.executor import output_repositories
from vcstool.executor import output_results
from vcstool.streams import set_streams
import yaml

from .command import add_common_arguments
from .command import Command


class ImportCommand(Command):

    command = 'import'
    help = 'Import the list of repositories'

    def __init__(self, args, url, version=None, recursive=False):
        super(ImportCommand, self).__init__(args)
        self.url = url
        self.version = version
        self.force = args.force
        self.retry = args.retry
        self.skip_existing = args.skip_existing
        self.recursive = recursive


def get_parser():
    parser = argparse.ArgumentParser(
github dirk-thomas / vcstool / vcstool / commands / diff.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class DiffCommand(Command):

    command = 'diff'
    help = 'Show changes in the working tree'

    def __init__(self, args):
        super(DiffCommand, self).__init__(args)
        self.context = args.context


def get_parser():
    parser = argparse.ArgumentParser(
        description='Show changes in the working tree', prog='vcs diff')
    group = parser.add_argument_group('"diff" command parameters')
    group.add_argument(
        '--context', metavar='N', type=int,
        help='Generate diffs with  lines of context')
github dirk-thomas / vcstool / vcstool / commands / branch.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class BranchCommand(Command):

    command = 'branch'
    help = 'Show the branches'

    def __init__(self, args):
        super(BranchCommand, self).__init__(args)
        self.all = args.all


def get_parser():
    parser = argparse.ArgumentParser(
        description='Show the current branch', prog='vcs branch')
    group = parser.add_argument_group('"branch" command parameters')
    group.add_argument(
        '--all', action='store_true', default=False, help='Show all branches')
    return parser
github dirk-thomas / vcstool / vcstool / commands / pull.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class PullCommand(Command):

    command = 'pull'
    help = 'Bring changes from the repository into the working copy'

    def __init__(self, args):
        super(PullCommand, self).__init__(args)


def get_parser():
    parser = argparse.ArgumentParser(
        description='Bring changes from the repository into the working copy',
        prog='vcs pull')
    parser.add_argument_group('"pull" command parameters')
    return parser
github dirk-thomas / vcstool / vcstool / commands / log.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class LogCommand(Command):

    command = 'log'
    help = 'Show commit logs'

    def __init__(self, args):
        super(LogCommand, self).__init__(args)
        self.limit = args.limit
        self.limit_tag = args.limit_tag
        self.limit_untagged = args.limit_untagged


def get_parser():
    parser = argparse.ArgumentParser(
        description='Show commit logs', prog='vcs log')
    group = parser.add_argument_group('"log" command parameters')
    group.add_argument(
github dirk-thomas / vcstool / vcstool / commands / status.py View on Github external
import argparse
import sys

from vcstool.streams import set_streams

from .command import Command
from .command import simple_main


class StatusCommand(Command):

    command = 'status'
    help = 'Show the working tree status'

    def __init__(self, args):
        super(StatusCommand, self).__init__(args)
        self.quiet = args.quiet


def get_parser():
    parser = argparse.ArgumentParser(
        description='Show the working tree status', prog='vcs status')
    group = parser.add_argument_group('"status" command parameters')
    group.add_argument(
        '-q', '--quiet', action='store_true', default=False,
        help="Don't show unversioned items")