Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import os
import shutil
from threading import Lock
from vcstool.executor import USE_COLOR
from .vcs_base import VcsClientBase
from .vcs_base import which
class HgClient(VcsClientBase):
type = 'hg'
_executable = None
_config_color = None
_config_color_lock = Lock()
@staticmethod
def is_repository(path):
return os.path.isdir(os.path.join(path, '.hg'))
def __init__(self, path):
super(HgClient, self).__init__(path)
def branch(self, command):
self._check_executable()
cmd = [HgClient._executable, 'branches' if command.all else 'branch']
def __getattribute__(self, name):
if name == 'import':
try:
return self.import_
except AttributeError:
pass
return super(VcsClientBase, self).__getattribute__(name)
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
try:
from urllib.error import URLError
except ImportError:
from urllib2 import URLError
import zipfile
from .vcs_base import load_url
from .vcs_base import test_url
from .vcs_base import VcsClientBase
class ZipClient(VcsClientBase):
type = 'zip'
@staticmethod
def is_repository(path):
return False
def __init__(self, path):
super(ZipClient, self).__init__(path)
def import_(self, command):
if not command.url:
return {
'cmd': '',
'cwd': self.path,
'output': "Repository data lacks the 'url' value",
import os
from xml.etree.ElementTree import fromstring
from .vcs_base import VcsClientBase, which
class SvnClient(VcsClientBase):
type = 'svn'
_executable = None
@staticmethod
def is_repository(path):
return os.path.isdir(os.path.join(path, '.svn'))
def __init__(self, path):
super(SvnClient, self).__init__(path)
def branch(self, command):
if command.all:
return self._not_applicable(
command,
message='at least with the option to list all branches')
import copy
import os
import shutil
from .vcs_base import VcsClientBase
from .vcs_base import which
class BzrClient(VcsClientBase):
type = 'bzr'
_executable = None
@staticmethod
def is_repository(path):
return os.path.isdir(os.path.join(path, '.bzr'))
def __init__(self, path):
super(BzrClient, self).__init__(path)
def branch(self, command):
if command.all:
return self._not_applicable(
command,
message='at least with the option to list all branches')
import os
import shutil
from vcstool.executor import USE_COLOR
from .vcs_base import VcsClientBase
from .vcs_base import which
class GitClient(VcsClientBase):
type = 'git'
_executable = None
_config_color_is_auto = None
@staticmethod
def is_repository(path):
return os.path.isdir(os.path.join(path, '.git'))
def __init__(self, path):
super(GitClient, self).__init__(path)
def branch(self, command):
self._check_executable()
cmd = [GitClient._executable, 'branch']
result = self._run_command(cmd)
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
import tarfile
try:
from urllib.error import URLError
except ImportError:
from urllib2 import URLError
from .vcs_base import load_url
from .vcs_base import test_url
from .vcs_base import VcsClientBase
class TarClient(VcsClientBase):
type = 'tar'
@staticmethod
def is_repository(path):
return False
def __init__(self, path):
super(TarClient, self).__init__(path)
def import_(self, command):
if not command.url:
return {
'cmd': '',
'cwd': self.path,
'output': "Repository data lacks the 'url' value",