~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/commands/test_branch.py

  • Committer: Vincent Ladeuil
  • Date: 2007-06-06 13:52:02 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070606135202-mqhxcv6z57uce434
Fix merge multiple connections. Test suite *not* passing (sftp
refactoring pending but unrelated to merge).

* bzrlib/builtins.py:
(cmd_merge.run): Fix the multiple connections bug by reusing the
tramsport used to check for a bundle and keep all other used
transports in possible_transports.
(_merge_helper): Add a possible_transports parameter for
reuse.

* bzrlib/transport/__init__.py:
(Transport._reuse_for): By default, Transports are not reusable.
(ConnectedTransport._reuse_for): ConnectedTransports are reusable
under certain conditions.
(_urlRE): Fix misleading group name.
(_try_transport_factories): Moved after get_transport (another use
case for moved lines). The do_catching_redirections was
incorrectly inserted between get_transport and
_try_transport_factories.

* bzrlib/tests/test_transport.py:
(TestReusedTransports.test_reuse_same_transport)
(TestReusedTransports.test_don_t_reuse_different_transport): Add
more tests.

* bzrlib/merge.py:
(_get_tree, Merger.set_other): Add a possible_transports parameter
for reuse.

* bzrlib/bzrdir.py:
(BzrDir.open_containing): Add a possible_transports parameter for
reuse.

* bzrlib/branch.py:
(Branch.open_containing): Add a possible_transports parameter for
reuse.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
 
18
18
from bzrlib.builtins import cmd_branch
19
 
from bzrlib.tests.transport_util import TestCaseWithConnectionHookedTransport
 
19
from bzrlib.tests.TransportUtil import TestCaseWithConnectionHookedTransport
20
20
 
21
21
 
22
22
class TestBranch(TestCaseWithConnectionHookedTransport):
24
24
    def setUp(self):
25
25
        super(TestBranch, self).setUp()
26
26
        self.make_branch_and_tree('branch')
27
 
        self.start_logging_connections()
 
27
        self.install_hooks()
 
28
        self.addCleanup(self.reset_hooks)
28
29
 
29
30
    def test_branch_remote_local(self):
30
31
        cmd = cmd_branch()
31
 
        cmd.run(self.get_url('branch'), 'local')
 
32
        cmd.run(self.get_url() + '/branch', 'local')
32
33
        self.assertEquals(1, len(self.connections))
33
34
 
 
35
    # This is bug 112173
34
36
    def test_branch_local_remote(self):
35
37
        cmd = cmd_branch()
36
 
        cmd.run('branch', self.get_url('remote'))
 
38
        cmd.run('branch', self.get_url() + '/remote')
37
39
        self.assertEquals(1, len(self.connections))
38
40
 
 
41
    # This is bug 112173 too
39
42
    def test_branch_remote_remote(self):
40
43
        cmd = cmd_branch()
41
 
        cmd.run(self.get_url('branch'), self.get_url('remote'))
 
44
        cmd.run(self.get_url() + '/branch', self.get_url() + '/remote')
42
45
        self.assertEquals(2, len(self.connections))
43
46