Ejemplo n.º 1
0
def force_bzr_to_use_urllib():
    """Prevent bzr from using pycurl to connect to http: urls.

    We want this because pycurl rejects self signed certificates, which
    prevents a significant number of import branchs from updating.  Also see
    https://bugs.launchpad.net/bzr/+bug/516222.
    """
    from bzrlib.transport import register_lazy_transport
    register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
    register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
Ejemplo n.º 2
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BackupTransportHandler')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BadTransportHandler')
     t = transport.get_transport_from_url('foo://fooserver/foo')
     self.assertTrue(isinstance(t, BackupTransportHandler))
Ejemplo n.º 3
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BackupTransportHandler')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BadTransportHandler')
     t = transport.get_transport_from_url('foo://fooserver/foo')
     self.assertTrue(isinstance(t, BackupTransportHandler))
Ejemplo n.º 4
0
def force_bzr_to_use_urllib():
    """Prevent bzr from using pycurl to connect to http: urls.

    We want this because pycurl rejects self signed certificates, which
    prevents a significant number of import branchs from updating.  Also see
    https://bugs.launchpad.net/bzr/+bug/516222.
    """
    from bzrlib.transport import register_lazy_transport
    register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
    register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
Ejemplo n.º 5
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = _get_protocol_handlers()
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'BackupTransportHandler')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'BadTransportHandler')
         t = get_transport('foo://fooserver/foo')
         self.assertTrue(isinstance(t, BackupTransportHandler))
     finally:
         _set_protocol_handlers(saved_handlers)
Ejemplo n.º 6
0
 def test_transport_fallback(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = _get_protocol_handlers()
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                 'BackupTransportHandler')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                 'BadTransportHandler')
         t = get_transport('foo://fooserver/foo')
         self.assertTrue(isinstance(t, BackupTransportHandler))
     finally:
         _set_protocol_handlers(saved_handlers)
Ejemplo n.º 7
0
def force_bzr_to_use_urllib():
    # These lines prevent bzr from using pycurl to connect to http: urls.  We
    # want this for two reasons:
    # 1) pycurl rejects self signed certificates, which prevents a significant
    #    number of mirror branchs from updating, and
    # 2) the script sometimes hangs inside pycurl, preventing all mirrors from
    #    being updated until the script is restarted.
    # There is no test for this (it would involve a great number of moving
    # parts) but it has been verified to work on production.  Also see
    # https://bugs.launchpad.net/bzr/+bug/82086
    from bzrlib.transport import register_lazy_transport
    register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
    register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
Ejemplo n.º 8
0
def force_bzr_to_use_urllib():
    # These lines prevent bzr from using pycurl to connect to http: urls.  We
    # want this for two reasons:
    # 1) pycurl rejects self signed certificates, which prevents a significant
    #    number of mirror branchs from updating, and
    # 2) the script sometimes hangs inside pycurl, preventing all mirrors from
    #    being updated until the script is restarted.
    # There is no test for this (it would involve a great number of moving
    # parts) but it has been verified to work on production.  Also see
    # https://bugs.launchpad.net/bzr/+bug/82086
    from bzrlib.transport import register_lazy_transport
    register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
    register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
                            'HttpTransport_urllib')
Ejemplo n.º 9
0
 def test_transport_dependency(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     # don't pollute the current handlers
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport(
         'foo', 'bzrlib.tests.test_transport', 'BadTransportHandler')
     try:
         transport.get_transport_from_url('foo://fooserver/foo')
     except errors.UnsupportedProtocol, e:
         e_str = str(e)
         self.assertEquals('Unsupported protocol'
                             ' for url "foo://fooserver/foo":'
                             ' Unable to import library "some_lib":'
                             ' testing missing dependency', str(e))
Ejemplo n.º 10
0
 def test_transport_dependency(self):
     """Transport with missing dependency causes no error"""
     saved_handlers = transport._get_protocol_handlers()
     self.addCleanup(transport._set_protocol_handlers, saved_handlers)
     # don't pollute the current handlers
     transport._clear_protocol_handlers()
     transport.register_transport_proto('foo')
     transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                       'BadTransportHandler')
     try:
         transport.get_transport_from_url('foo://fooserver/foo')
     except errors.UnsupportedProtocol, e:
         e_str = str(e)
         self.assertEqual(
             'Unsupported protocol'
             ' for url "foo://fooserver/foo":'
             ' Unable to import library "some_lib":'
             ' testing missing dependency', str(e))
Ejemplo n.º 11
0
 def test_get_transport_modules(self):
     handlers = _get_protocol_handlers()
     # don't pollute the current handlers
     _clear_protocol_handlers()
     class SampleHandler(object):
         """I exist, isnt that enough?"""
     try:
         _clear_protocol_handlers()
         register_transport_proto('foo')
         register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                 'TestTransport.SampleHandler')
         register_transport_proto('bar')
         register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                 'TestTransport.SampleHandler')
         self.assertEqual([SampleHandler.__module__,
                           'bzrlib.transport.chroot'],
                          _get_transport_modules())
     finally:
         _set_protocol_handlers(handlers)
Ejemplo n.º 12
0
    def test_get_transport_modules(self):
        handlers = transport._get_protocol_handlers()
        self.addCleanup(transport._set_protocol_handlers, handlers)
        # don't pollute the current handlers
        transport._clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""

        transport._clear_protocol_handlers()
        transport.register_transport_proto('foo')
        transport.register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                          'TestTransport.SampleHandler')
        transport.register_transport_proto('bar')
        transport.register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                          'TestTransport.SampleHandler')
        self.assertEqual([
            SampleHandler.__module__, 'bzrlib.transport.chroot',
            'bzrlib.transport.pathfilter'
        ], transport._get_transport_modules())
Ejemplo n.º 13
0
    def test_get_transport_modules(self):
        handlers = transport._get_protocol_handlers()
        self.addCleanup(transport._set_protocol_handlers, handlers)
        # don't pollute the current handlers
        transport._clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""
        transport._clear_protocol_handlers()
        transport.register_transport_proto('foo')
        transport.register_lazy_transport('foo',
                                            'bzrlib.tests.test_transport',
                                            'TestTransport.SampleHandler')
        transport.register_transport_proto('bar')
        transport.register_lazy_transport('bar',
                                            'bzrlib.tests.test_transport',
                                            'TestTransport.SampleHandler')
        self.assertEqual([SampleHandler.__module__,
                            'bzrlib.transport.chroot',
                            'bzrlib.transport.pathfilter'],
                            transport._get_transport_modules())
Ejemplo n.º 14
0
    def test_get_transport_modules(self):
        handlers = _get_protocol_handlers()
        # don't pollute the current handlers
        _clear_protocol_handlers()

        class SampleHandler(object):
            """I exist, isnt that enough?"""

        try:
            _clear_protocol_handlers()
            register_transport_proto('foo')
            register_lazy_transport('foo', 'bzrlib.tests.test_transport',
                                    'TestTransport.SampleHandler')
            register_transport_proto('bar')
            register_lazy_transport('bar', 'bzrlib.tests.test_transport',
                                    'TestTransport.SampleHandler')
            self.assertEqual(
                [SampleHandler.__module__, 'bzrlib.transport.chroot'],
                _get_transport_modules())
        finally:
            _set_protocol_handlers(handlers)
Ejemplo n.º 15
0
import bzrlib

# Don't go further if we are not compatible
if bzrlib.version_info < (1, 12):
    # We need bzr 1.12
    from bzrlib import trace
    trace.note('not installing http[s]+webdav:// support'
               ' (only supported for bzr 1.12 and above)')
else:
    from bzrlib import transport

    transport.register_urlparse_netloc_protocol('http+webdav')
    transport.register_urlparse_netloc_protocol('https+webdav')

    transport.register_lazy_transport('https+webdav://',
                                      'bzrlib.plugins.webdav.webdav',
                                      'HttpDavTransport')
    transport.register_lazy_transport('http+webdav://',
                                      'bzrlib.plugins.webdav.webdav',
                                      'HttpDavTransport')


    def load_tests(basic_tests, module, loader):
        testmod_names = [
            'tests',
            ]
        basic_tests.addTest(loader.loadTestsFromModuleNames(
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
        return basic_tests

Ejemplo n.º 16
0
from bzrlib.transport import register_lazy_transport
from bzrlib.commands import Command, register_command
from bzrlib.option import Option

bzrdir.format_registry.register(
    'git',
    LocalGitBzrDirFormat,
    help='GIT repository.',
    native=False,
    experimental=True,
)

bzrdir.BzrDirFormat.register_control_format(LocalGitBzrDirFormat)
bzrdir.BzrDirFormat.register_control_format(RemoteGitBzrDirFormat)

register_lazy_transport("git://", 'bzrlib.plugins.git.remote',
                        'GitSmartTransport')


class ForeignGit(ForeignVcs):
    """Foreign Git."""


git_mapping_registry = VcsMappingRegistry()
git_mapping_registry.register_lazy('git-experimental',
                                   "bzrlib.plugins.git.mapping",
                                   "BzrGitMappingExperimental")
foreign_vcs_registry.register("git", ForeignGit(git_mapping_registry),
                              "Stupid content tracker")


class cmd_git_serve(Command):
Ejemplo n.º 17
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.
    DIFF_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S'
Ejemplo n.º 18
0
from bzrlib.foreign import ForeignVcs, VcsMappingRegistry, foreign_vcs_registry
from bzrlib.plugins.git.dir import LocalGitBzrDirFormat, RemoteGitBzrDirFormat
from bzrlib.transport import register_lazy_transport
from bzrlib.commands import Command, register_command
from bzrlib.option import Option

bzrdir.format_registry.register(
    'git', LocalGitBzrDirFormat,
    help='GIT repository.', 
    native=False, experimental=True,
    )

bzrdir.BzrDirFormat.register_control_format(LocalGitBzrDirFormat)
bzrdir.BzrDirFormat.register_control_format(RemoteGitBzrDirFormat)

register_lazy_transport("git://", 'bzrlib.plugins.git.remote',
                        'GitSmartTransport')


class ForeignGit(ForeignVcs):
    """Foreign Git."""


git_mapping_registry = VcsMappingRegistry()
git_mapping_registry.register_lazy('git-experimental', "bzrlib.plugins.git.mapping",
                                   "BzrGitMappingExperimental")
foreign_vcs_registry.register("git", ForeignGit(git_mapping_registry), 
                                      "Stupid content tracker")


class cmd_git_serve(Command):
    """Provide access to a Bazaar branch using the git protocol.
Ejemplo n.º 19
0
                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
Ejemplo n.º 20
0
                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
    # timestamp to the epoch time.