How to use the vcstool.clients.hg.HgClient 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 / hg.py View on Github external
def _check_color(self, cmd):
        if not USE_COLOR:
            return
        with HgClient._config_color_lock:
            # check if user uses colorization
            if HgClient._config_color is None:
                HgClient._config_color = False
                # check if config extension is available
                _cmd = [HgClient._executable, 'config', '--help']
                result = self._run_command(_cmd)
                if result['returncode']:
                    return
                # check if color extension is available and not disabled
                _cmd = [HgClient._executable, 'config', 'extensions.color']
                result = self._run_command(_cmd)
                if result['returncode'] or result['output'].startswith('!'):
                    return
                # check if color mode is not off or not set
                _cmd = [HgClient._executable, 'config', 'color.mode']
                result = self._run_command(_cmd)
                if not result['returncode'] and result['output'] == 'off':
                    return
                HgClient._config_color = True

        # inject arguments to force colorization
        if HgClient._config_color:
            cmd[1:1] = '--color', 'always'
github dirk-thomas / vcstool / vcstool / clients / hg.py View on Github external
def __init__(self, path):
        super(HgClient, self).__init__(path)
github dirk-thomas / vcstool / vcstool / clients / hg.py View on Github external
# check if config extension is available
                _cmd = [HgClient._executable, 'config', '--help']
                result = self._run_command(_cmd)
                if result['returncode']:
                    return
                # check if color extension is available and not disabled
                _cmd = [HgClient._executable, 'config', 'extensions.color']
                result = self._run_command(_cmd)
                if result['returncode'] or result['output'].startswith('!'):
                    return
                # check if color mode is not off or not set
                _cmd = [HgClient._executable, 'config', 'color.mode']
                result = self._run_command(_cmd)
                if not result['returncode'] and result['output'] == 'off':
                    return
                HgClient._config_color = True

        # inject arguments to force colorization
        if HgClient._config_color:
            cmd[1:1] = '--color', 'always'
github dirk-thomas / vcstool / vcstool / clients / __init__.py View on Github external
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:
    from .tar import TarClient
    vcstool_clients.append(TarClient)
except ImportError:
    pass

try:
github dirk-thomas / vcstool / vcstool / clients / hg.py View on Github external
'cwd': self.path,
                        'output':
                            'Path already exists and contains a different '
                            'repository',
                        'returncode': 1
                    }
                try:
                    shutil.rmtree(self.path)
                except OSError:
                    os.remove(self.path)

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

        if HgClient.is_repository(self.path):
            # pull updates for existing repo
            cmd_pull = [
                HgClient._executable, '--noninteractive', 'pull', '--update']
            result_pull = self._run_command(cmd_pull, retry=command.retry)
            if result_pull['returncode']:
                return result_pull
            cmd = result_pull['cmd']
            output = result_pull['output']

        else:
            cmd_clone = [
                HgClient._executable, '--noninteractive', 'clone', command.url,
                '.']
            result_clone = self._run_command(cmd_clone, retry=command.retry)
            if result_clone['returncode']:
                result_clone['output'] = \
github dirk-thomas / vcstool / vcstool / clients / hg.py View on Github external
def _check_color(self, cmd):
        if not USE_COLOR:
            return
        with HgClient._config_color_lock:
            # check if user uses colorization
            if HgClient._config_color is None:
                HgClient._config_color = False
                # check if config extension is available
                _cmd = [HgClient._executable, 'config', '--help']
                result = self._run_command(_cmd)
                if result['returncode']:
                    return
                # check if color extension is available and not disabled
                _cmd = [HgClient._executable, 'config', 'extensions.color']
                result = self._run_command(_cmd)
                if result['returncode'] or result['output'].startswith('!'):
                    return
                # check if color mode is not off or not set
                _cmd = [HgClient._executable, 'config', 'color.mode']
                result = self._run_command(_cmd)