/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/bzrdir.py

  • Committer: Vincent Ladeuil
  • Date: 2008-12-12 13:09:26 UTC
  • mfrom: (3878.4.7 303959-redirection)
  • mto: This revision was merged to the branch mainline in revision 3903.
  • Revision ID: v.ladeuil+lp@free.fr-20081212130926-ov09evfb53npj0z0
Fix redirection related bugs: #245964, #265070, #270863 and #303959

Show diffs side-by-side

added added

removed removed

Lines of Context:
782
782
        :param transport: Transport containing the bzrdir.
783
783
        :param _unsupported: private.
784
784
        """
 
785
        # Keep initial base since 'transport' may be modified while following
 
786
        # the redirections.
785
787
        base = transport.base
786
 
 
787
788
        def find_format(transport):
788
789
            return transport, BzrDirFormat.find_format(
789
790
                transport, _server_formats=_server_formats)
790
791
 
791
792
        def redirected(transport, e, redirection_notice):
792
 
            qualified_source = e.get_source_url()
793
 
            relpath = transport.relpath(qualified_source)
794
 
            if not e.target.endswith(relpath):
795
 
                # Not redirected to a branch-format, not a branch
796
 
                raise errors.NotBranchError(path=e.target)
797
 
            target = e.target[:-len(relpath)]
 
793
            redirected_transport = transport._redirected_to(e.source, e.target)
 
794
            if redirected_transport is None:
 
795
                raise errors.NotBranchError(base)
798
796
            note('%s is%s redirected to %s',
799
 
                 transport.base, e.permanently, target)
800
 
            # Let's try with a new transport
801
 
            # FIXME: If 'transport' has a qualifier, this should
802
 
            # be applied again to the new transport *iff* the
803
 
            # schemes used are the same. Uncomment this code
804
 
            # once the function (and tests) exist.
805
 
            # -- vila20070212
806
 
            #target = urlutils.copy_url_qualifiers(original, target)
807
 
            return get_transport(target)
 
797
                 transport.base, e.permanently, redirected_transport.base)
 
798
            return redirected_transport
808
799
 
809
800
        try:
810
801
            transport, format = do_catching_redirections(find_format,