How to use the vcstool.clients.vcs_base.VcsClientBase 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
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']
github dirk-thomas / vcstool / vcstool / clients / vcs_base.py View on Github external
def __getattribute__(self, name):
        if name == 'import':
            try:
                return self.import_
            except AttributeError:
                pass
        return super(VcsClientBase, self).__getattribute__(name)
github dirk-thomas / vcstool / vcstool / clients / zip.py View on Github external
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",
github dirk-thomas / vcstool / vcstool / clients / svn.py View on Github external
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')
github dirk-thomas / vcstool / vcstool / clients / bzr.py View on Github external
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')
github dirk-thomas / vcstool / vcstool / clients / git.py View on Github external
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)
github dirk-thomas / vcstool / vcstool / clients / tar.py View on Github external
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",