Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'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
def __init__(self, path):
super(BzrClient, self).__init__(path)
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')
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: