# Path: vcstool/clients/vcs_base.py
# class VcsClientBase(object):
# 
#     type = None
# 
#     def __init__(self, path):
#         self.path = path
# 
#     def __getattribute__(self, name):
#         if name == 'import':
#             try:
#                 return self.import_
#             except AttributeError:
#                 pass
#         return super(VcsClientBase, self).__getattribute__(name)
# 
#     def _not_applicable(self, command, message=None):
#         return {
#             'cmd': '%s.%s(%s)' % (
#                 self.__class__.type, 'push', command.__class__.command),
#             'output': "Command '%s' not applicable for client '%s'%s" % (
#                 command.__class__.command, self.__class__.type,
#                 ': ' + message if message else ''),
#             'returncode': NotImplemented
#         }
# 
#     def _run_command(self, cmd, env=None, retry=0):
#         for i in range(retry + 1):
#             result = run_command(cmd, os.path.abspath(self.path), env=env)
#             if not result['returncode']:
#                 # return successful result
#                 break
#             if i >= retry:
#                 # return the failure after retries
#                 break
#             # increasing sleep before each retry
#             time.sleep(i + 1)
#         return result
# 
#     def _create_path(self):
#         if not os.path.exists(self.path):
#             try:
#                 os.makedirs(self.path)
#             except os.error as e:
#                 return {
#                     'cmd': 'os.makedirs(%s)' % self.path,
#                     'cwd': self.path,
#                     'output':
#                         "Could not create directory '%s': %s" % (self.path, e),
#                     'returncode': 1
#                 }
#         return None


import os
from shutil import which
from xml.etree.ElementTree import fromstring
from .vcs_base import VcsClientBase
                SvnClient._executable, 'info',
                command.url + '@' + command.version]
            result_info_ver = self._run_command(
                cmd_info_ver,
                retry=command.retry)

            if result_info_ver['returncode']:
                result_info_ver['output'] = \
                    'Specified version not found on remote repository' + \
                    "'%s@%s' : %s" % \
                    (command.url, command.version, result_info_ver['output'])
                return result_info_ver

            cmd = result_info_ver['cmd']
            output = "Found svn repository '%s' with revision '%s'" % \
                (command.url, command.version)
        else:
            cmd = result_info_repo['cmd']
            output = "Found svn repository '%s' with default branch" % \
                command.url

        return {
            'cmd': cmd,
            'cwd': self.path,
            'output': output,
            'returncode': None
        }

    def _check_executable(self):
        assert SvnClient._executable is not None, \

# Path: vcstool/clients/vcs_base.py
# class VcsClientBase(object):
# 
#     type = None
# 
#     def __init__(self, path):
#         self.path = path
# 
#     def __getattribute__(self, name):
#         if name == 'import':
#             try:
#                 return self.import_
#             except AttributeError:
#                 pass
#         return super(VcsClientBase, self).__getattribute__(name)
# 
#     def _not_applicable(self, command, message=None):
#         return {
#             'cmd': '%s.%s(%s)' % (
#                 self.__class__.type, 'push', command.__class__.command),
#             'output': "Command '%s' not applicable for client '%s'%s" % (
#                 command.__class__.command, self.__class__.type,
#                 ': ' + message if message else ''),
#             'returncode': NotImplemented
#         }
# 
#     def _run_command(self, cmd, env=None, retry=0):
#         for i in range(retry + 1):
#             result = run_command(cmd, os.path.abspath(self.path), env=env)
#             if not result['returncode']:
#                 # return successful result
#                 break
#             if i >= retry:
#                 # return the failure after retries
#                 break
#             # increasing sleep before each retry
#             time.sleep(i + 1)
#         return result
# 
#     def _create_path(self):
#         if not os.path.exists(self.path):
#             try:
#                 os.makedirs(self.path)
#             except os.error as e:
#                 return {
#                     'cmd': 'os.makedirs(%s)' % self.path,
#                     'cwd': self.path,
#                     'output':
#                         "Could not create directory '%s': %s" % (self.path, e),
#                     'returncode': 1
#                 }
#         return None


# Path: vcstool/clients/svn.py
import os
from shutil import which
from xml.etree.ElementTree import fromstring
from .vcs_base import VcsClientBase

                SvnClient._executable, 'info',
                command.url + '@' + command.version]
            result_info_ver = self._run_command(
                cmd_info_ver,
                retry=command.retry)

            if result_info_ver['returncode']:
                result_info_ver['output'] = \
                    'Specified version not found on remote repository' + \
                    "'%s@%s' : %s" % \
                    (command.url, command.version, result_info_ver['output'])
                return result_info_ver

            cmd = result_info_ver['cmd']
            output = "Found svn repository '%s' with revision '%s'" % \
                (command.url, command.version)
        else:
            cmd = result_info_repo['cmd']
            output = "Found svn repository '%s' with default branch" % \
                command.url

        return {
            'cmd': cmd,
            'cwd': self.path,
            'output': output,
            'returncode': None
        }

    def _check_executable(self):
        assert SvnClient._executable is not None, \

            "Could not find 'svn' executable"