How to use the vcstool.clients.git.GitClient 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 / clients / git.py View on Github external
def _check_color(self, cmd):
        if not USE_COLOR:
            return
        # check if user uses colorization
        if GitClient._config_color_is_auto is None:
            _cmd = [GitClient._executable, 'config', '--get', 'color.ui']
            result = self._run_command(_cmd)
            GitClient._config_color_is_auto = result['output'] in ['', 'auto']

        # inject arguments to force colorization
        if GitClient._config_color_is_auto:
            cmd[1:1] = '-c', 'color.ui=always'
github dirk-thomas / vcstool / vcstool / clients / __init__.py View on Github external
vcstool_clients = []

try:
    from .bzr import BzrClient
    vcstool_clients.append(BzrClient)
except ImportError:
    pass

try:
    from .git import GitClient
    vcstool_clients.append(GitClient)
except ImportError:
    pass

try:
    from .hg import HgClient
    vcstool_clients.append(HgClient)
except ImportError:
    pass

try:
    from .svn import SvnClient
    vcstool_clients.append(SvnClient)
except ImportError:
    pass

try:
github dirk-thomas / vcstool / vcstool / clients / git.py View on Github external
def _check_color(self, cmd):
        if not USE_COLOR:
            return
        # check if user uses colorization
        if GitClient._config_color_is_auto is None:
            _cmd = [GitClient._executable, 'config', '--get', 'color.ui']
            result = self._run_command(_cmd)
            GitClient._config_color_is_auto = result['output'] in ['', 'auto']

        # inject arguments to force colorization
        if GitClient._config_color_is_auto:
            cmd[1:1] = '-c', 'color.ui=always'
github dirk-thomas / vcstool / vcstool / clients / git.py View on Github external
try:
                    shutil.rmtree(self.path)
                except OSError:
                    os.remove(self.path)
        elif command.force and os.path.exists(self.path):
            # Not empty, not a git repository
            try:
                shutil.rmtree(self.path)
            except OSError:
                os.remove(self.path)

        not_exist = self._create_path()
        if not_exist:
            return not_exist

        if GitClient.is_repository(self.path):
            if command.skip_existing:
                checkout_version = None
            elif command.version:
                checkout_version = command.version
            else:
                # determine remote HEAD branch
                cmd_remote = [GitClient._executable, 'remote', 'show', remote]
                # override locale in order to parse output
                env = os.environ.copy()
                env['LC_ALL'] = 'C'
                result_remote = self._run_command(cmd_remote, env=env)
                if result_remote['returncode']:
                    result_remote['output'] = \
                        'Could not get remote information of repository ' \
                        "'%s': %s" % (url, result_remote['output'])
                    return result_remote
github dirk-thomas / vcstool / vcstool / clients / git.py View on Github external
def __init__(self, path):
        super(GitClient, self).__init__(path)