~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.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:
52
52
 
53
53
# TODO: Report back as changes are merged in
54
54
 
55
 
def _get_tree(treespec, local_branch=None):
 
55
def _get_tree(treespec, local_branch=None, possible_transports=None):
56
56
    from bzrlib import workingtree
57
57
    location, revno = treespec
58
58
    if revno is None:
59
59
        tree = workingtree.WorkingTree.open_containing(location)[0]
60
60
        return tree.branch, tree
61
 
    branch = Branch.open_containing(location)[0]
 
61
    branch = Branch.open_containing(location, possible_transports)[0]
62
62
    if revno == -1:
63
63
        revision_id = branch.last_revision()
64
64
    else:
206
206
            return
207
207
        self.this_tree.add_parent_tree((self.other_rev_id, self.other_tree))
208
208
 
209
 
    def set_other(self, other_revision):
 
209
    def set_other(self, other_revision, possible_transports=None):
210
210
        """Set the revision and tree to merge from.
211
211
 
212
212
        This sets the other_tree, other_rev_id, other_basis attributes.
214
214
        :param other_revision: The [path, revision] list to merge from.
215
215
        """
216
216
        self.other_branch, self.other_tree = _get_tree(other_revision,
217
 
                                                  self.this_branch)
 
217
                                                       self.this_branch,
 
218
                                                       possible_transports)
218
219
        if other_revision[1] == -1:
219
220
            self.other_rev_id = self.other_branch.last_revision()
220
221
            if self.other_rev_id is None: