/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2007-06-05 15:52:12 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-20070605155212-k2za98dhobeikxhn
Fix pull multiple connections.

* bzrlib/builtins.py:
(cmd_pull.run): If 'location' wasn't a bundle, the transport may
be reused.

* bzrlib/branch.py:
(Branch.open_from_transport): New method.

* bzrlib/bundle/__init__.py:
(read_mergeable_from_transport): New method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
591
591
            branch_to = Branch.open_containing(directory)[0]
592
592
 
593
593
        reader = None
 
594
        # The user may provide a bundle or branch as 'location' We first try to
 
595
        # identify a bundle, if it's not, we try to preserve connection used by
 
596
        # the transport to access the branch.
594
597
        if location is not None:
595
 
            try:
596
 
                mergeable = bundle.read_mergeable_from_url(
597
 
                    location)
598
 
            except errors.NotABundle:
599
 
                pass # Continue on considering this url a Branch
 
598
            url = urlutils.normalize_url(location)
 
599
            url, filename = urlutils.split(url, exclude_trailing_slash=False)
 
600
            location_transport = transport.get_transport(url)
 
601
            if filename:
 
602
                try:
 
603
                    read_bundle = bundle.read_mergeable_from_transport
 
604
                    # There may be redirections but we ignore the intermediate
 
605
                    # and final transports used
 
606
                    mergeable, t = read_bundle(location_transport, filename)
 
607
                except errors.NotABundle:
 
608
                    # Continue on considering this url a Branch but adjust the
 
609
                    # location_transport
 
610
                    location_transport = location_transport.clone(filename)
 
611
            else:
 
612
                # A directory was provided, location_transport is correct
 
613
                pass
600
614
 
601
615
        stored_loc = branch_to.get_parent()
602
616
        if location is None:
608
622
                        self.outf.encoding)
609
623
                self.outf.write("Using saved location: %s\n" % display_url)
610
624
                location = stored_loc
 
625
                location_transport = transport.get_transport(location)
611
626
 
612
627
        if mergeable is not None:
613
628
            if revision is not None:
616
631
            revision_id = mergeable.install_revisions(branch_to.repository)
617
632
            branch_from = branch_to
618
633
        else:
619
 
            branch_from = Branch.open(location)
 
634
            branch_from = Branch.open_from_transport(location_transport)
620
635
 
621
636
            if branch_to.get_parent() is None or remember:
622
637
                branch_to.set_parent(branch_from.base)