Ejemplo n.º 1
0
GIT_DIFF_EMPTY_CHANGESET_SIZE = 3

try:
    import urlparse
    uses_netloc = urlparse.uses_netloc
    urllib_urlparse = urlparse.urlparse
except ImportError:
    import urllib.parse
    uses_netloc = urllib.parse.uses_netloc
    urllib_urlparse = urllib.parse.urlparse

# Register these URI schemes so we can handle them properly.
uses_netloc.append('git')

sshutils.register_rbssh('GIT_SSH')


class ShortSHA1Error(InvalidRevisionFormatError):
    def __init__(self, path, revision, *args, **kwargs):
        InvalidRevisionFormatError.__init__(
            self,
            path=path,
            revision=revision,
            detail=six.text_type(
                _('The SHA1 is too short. Make sure the diff '
                  'is generated with `git diff '
                  '--full-index`.')),
            *args,
            **kwargs)
Ejemplo n.º 2
0
            else:
                self.local_site_name = None

            super(RBRemoteSSHTransport, self).__init__(
                base.encode('ascii'), *args, **kwargs)

        def _build_medium(self):
            client_medium, auth = \
                super(RBRemoteSSHTransport, self)._build_medium()
            client_medium._vendor = RBSSHVendor(self.local_site_name)
            return client_medium, auth

    vendor = RBSSHVendor()
    register_ssh_vendor("rbssh", vendor)
    register_default_ssh_vendor(vendor)
    sshutils.register_rbssh('BZR_SSH')
    register_lazy_transport('bzr+ssh://', 'reviewboard.scmtools.bzr',
                            'RBRemoteSSHTransport')


class BZRTool(SCMTool):
    """An interface to the Bazaar SCM (http://bazaar-vcs.org/)"""
    name = "Bazaar"
    dependencies = {
        'modules': ['bzrlib'],
    }

    # Timestamp format in bzr diffs.
    # This isn't totally accurate: there should be a %z at the end.
    # Unfortunately, strptime() doesn't support %z.
    DIFF_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S'
Ejemplo n.º 3
0
from django.utils import six
from django.utils.six.moves.urllib.parse import urlparse
from djblets.util.filesystem import is_exe_in_path

from reviewboard.scmtools.core import SCMTool, HEAD, PRE_CREATION
from reviewboard.scmtools.errors import (AuthenticationError,
                                         SCMError,
                                         FileNotFoundError,
                                         RepositoryNotFoundError)
from reviewboard.diffviewer.parser import DiffParser, DiffParserError
from reviewboard.ssh import utils as sshutils
from reviewboard.ssh.errors import SSHAuthenticationError, SSHError


sshutils.register_rbssh('CVS_RSH')


class CVSTool(SCMTool):
    name = "CVS"
    supports_authentication = True
    field_help_text = {
        'path': 'The CVSROOT used to access the repository.',
    }
    dependencies = {
        'executables': ['cvs'],
    }

    rev_re = re.compile(r'^.*?(\d+(\.\d+)+)\r?$')
    repopath_re = re.compile(r'^(?P<hostname>.*):(?P<port>\d+)?(?P<path>.*)')
    ext_cvsroot_re = re.compile(r':ext:([^@]+@)?(?P<hostname>[^:/]+)')
Ejemplo n.º 4
0
from reviewboard.diffviewer.parser import DiffParser
from reviewboard.scmtools.certs import Certificate
from reviewboard.scmtools.core import SCMTool, HEAD, PRE_CREATION, UNKNOWN
from reviewboard.scmtools.errors import AuthenticationError, \
                                        FileNotFoundError, \
                                        RepositoryNotFoundError, \
                                        SCMError, \
                                        UnverifiedCertificateError
from reviewboard.ssh import utils as sshutils


# Register these URI schemes so we can handle them properly.
sshutils.ssh_uri_schemes.append('svn+ssh')

sshutils.register_rbssh('SVN_SSH')


class SVNCertificateFailures:
    """SVN HTTPS certificate failure codes.

    These map to the various SVN HTTPS certificate failures in libsvn.
    """
    NOT_YET_VALID = 1 << 0
    EXPIRED       = 1 << 1
    CN_MISMATCH   = 1 << 2
    UNKNOWN_CA    = 1 << 3


class SVNTool(SCMTool):
    name = "Subversion"
Ejemplo n.º 5
0
import re
import tempfile

from django.utils import six
from django.utils.six.moves.urllib.parse import urlparse
from djblets.util.filesystem import is_exe_in_path

from reviewboard.scmtools.core import SCMTool, HEAD, PRE_CREATION
from reviewboard.scmtools.errors import (AuthenticationError, SCMError,
                                         FileNotFoundError,
                                         RepositoryNotFoundError)
from reviewboard.diffviewer.parser import DiffParser, DiffParserError
from reviewboard.ssh import utils as sshutils
from reviewboard.ssh.errors import SSHAuthenticationError, SSHError

sshutils.register_rbssh('CVS_RSH')


class CVSTool(SCMTool):
    name = "CVS"
    field_help_text = {
        'path': 'The CVSROOT used to access the repository.',
    }
    dependencies = {
        'executables': ['cvs'],
    }

    rev_re = re.compile(r'^.*?(\d+(\.\d+)+)\r?$')
    repopath_re = re.compile(
        r'^((?P<cnxmethod>:[gkp]server:)'
        r'((?P<username>[^:@]+)(:(?P<password>[^@]+))?@)?)?'
Ejemplo n.º 6
0
try:
    import urlparse
    uses_netloc = urlparse.uses_netloc
    urllib_urlparse = urlparse.urlparse
except ImportError:
    import urllib.parse
    uses_netloc = urllib.parse.uses_netloc
    urllib_urlparse = urllib.parse.urlparse


# Register these URI schemes so we can handle them properly.
uses_netloc.append('git')


sshutils.register_rbssh('GIT_SSH')


class ShortSHA1Error(InvalidRevisionFormatError):
    def __init__(self, path, revision, *args, **kwargs):
        InvalidRevisionFormatError.__init__(
            self,
            path=path,
            revision=revision,
            detail=six.text_type(_('The SHA1 is too short. Make sure the diff '
                                   'is generated with `git diff '
                                   '--full-index`.')),
            *args, **kwargs)


class GitTool(SCMTool):
Ejemplo n.º 7
0
                base = base.replace(m.group(0), '')
            else:
                self.local_site_name = None

            super(RBRemoteSSHTransport, self).__init__(base, *args, **kwargs)

        def _build_medium(self):
            client_medium, auth = \
                super(RBRemoteSSHTransport, self)._build_medium()
            client_medium._vendor = RBSSHVendor(self.local_site_name)
            return client_medium, auth

    vendor = RBSSHVendor()
    register_ssh_vendor("rbssh", vendor)
    register_default_ssh_vendor(vendor)
    sshutils.register_rbssh('BZR_SSH')
    register_lazy_transport('bzr+ssh://', 'reviewboard.scmtools.bzr',
                            'RBRemoteSSHTransport')

# BZRTool: An interface to Bazaar SCM Tool (http://bazaar-vcs.org/)


class BZRTool(SCMTool):
    name = "Bazaar"
    dependencies = {
        'modules': ['bzrlib'],
    }

    # Timestamp format in bzr diffs.
    # This isn't totally accurate: there should be a %z at the end.
    # Unfortunately, strptime() doesn't support %z.
Ejemplo n.º 8
0
    import urlparse

    uses_netloc = urlparse.uses_netloc
    urllib_urlparse = urlparse.urlparse
except ImportError:
    import urllib.parse

    uses_netloc = urllib.parse.uses_netloc
    urllib_urlparse = urllib.parse.urlparse


# Register these URI schemes so we can handle them properly.
uses_netloc.append("git")


sshutils.register_rbssh("GIT_SSH")


class ShortSHA1Error(InvalidRevisionFormatError):
    def __init__(self, path, revision, *args, **kwargs):
        InvalidRevisionFormatError.__init__(
            self,
            path=path,
            revision=revision,
            detail=six.text_type(
                _("The SHA1 is too short. Make sure the diff " "is generated with `git diff " "--full-index`.")
            ),
            *args,
            **kwargs
        )
Ejemplo n.º 9
0
from reviewboard.scmtools.certs import Certificate
from reviewboard.scmtools.core import Branch, Commit, SCMTool, HEAD, PRE_CREATION, UNKNOWN
from reviewboard.scmtools.errors import (
    AuthenticationError,
    FileNotFoundError,
    RepositoryNotFoundError,
    SCMError,
    UnverifiedCertificateError,
)
from reviewboard.ssh import utils as sshutils


# Register these URI schemes so we can handle them properly.
sshutils.ssh_uri_schemes.append("svn+ssh")

sshutils.register_rbssh("SVN_SSH")


class SVNCertificateFailures:
    """SVN HTTPS certificate failure codes.

    These map to the various SVN HTTPS certificate failures in libsvn.
    """

    NOT_YET_VALID = 1 << 0
    EXPIRED = 1 << 1
    CN_MISMATCH = 1 << 2
    UNKNOWN_CA = 1 << 3


class SVNTool(SCMTool):
Ejemplo n.º 10
0
                self.local_site_name = m.group(1)
                base = base.replace(m.group(0), "")
            else:
                self.local_site_name = None

            super(RBRemoteSSHTransport, self).__init__(base.encode("ascii"), *args, **kwargs)

        def _build_medium(self):
            client_medium, auth = super(RBRemoteSSHTransport, self)._build_medium()
            client_medium._vendor = RBSSHVendor(self.local_site_name)
            return client_medium, auth

    vendor = RBSSHVendor()
    register_ssh_vendor("rbssh", vendor)
    register_default_ssh_vendor(vendor)
    sshutils.register_rbssh("BZR_SSH")
    register_lazy_transport("bzr+ssh://", "reviewboard.scmtools.bzr", "RBRemoteSSHTransport")


class BZRTool(SCMTool):
    """An interface to the Bazaar SCM (http://bazaar-vcs.org/)"""

    name = "Bazaar"
    dependencies = {"modules": ["bzrlib"]}

    # Timestamp format in bzr diffs.
    # This isn't totally accurate: there should be a %z at the end.
    # Unfortunately, strptime() doesn't support %z.
    DIFF_TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S"

    # "bzr diff" indicates that a file is new by setting the old