How to use the vcstool.clients.bzr.BzrClient 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 / bzr.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 BzrClient.is_repository(self.path):
            # pull updates for existing repo
            cmd_pull = [BzrClient._executable, 'pull']
            return self._run_command(cmd_pull, retry=command.retry)

        else:
            cmd_branch = [BzrClient._executable, 'branch']
            if command.version:
                cmd_branch += ['-r', command.version]
            cmd_branch += [command.url, '.']
            result_branch = self._run_command(cmd_branch, retry=command.retry)
            if result_branch['returncode']:
                result_branch['output'] = \
                    "Could not branch repository '%s': %s" % \
                    (command.url, result_branch['output'])
                return result_branch
            return result_branch
github dirk-thomas / vcstool / vcstool / clients / bzr.py View on Github external
def __init__(self, path):
        super(BzrClient, self).__init__(path)
github dirk-thomas / vcstool / vcstool / clients / bzr.py View on Github external
if line.startswith(prefix):
                branch = line[len(prefix):]
                break
        if not branch:
            result['output'] = 'Could not determine parent branch',
            result['returncode'] = 1
            return result
        result['output'] = branch
        return result

    def _check_executable(self):
        assert BzrClient._executable is not None, \
            "Could not find 'bzr' executable"


if not BzrClient._executable:
    BzrClient._executable = which('bzr')
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: