/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 breezy/git/remote.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-07-26 17:52:41 UTC
  • mfrom: (7371.3.3 git-http-branch-url)
  • Revision ID: breezy.the.bot@gmail.com-20190726175241-5l7idcs4k55zs5ia
Fix extraction of paths from URLs when operating on remote Git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/git-http-branch-url/+merge/370161

Show diffs side-by-side

added added

removed removed

Lines of Context:
675
675
        url = urlutils.URL.from_string(transport.external_url())
676
676
        url.user = url.quoted_user = None
677
677
        url.password = url.quoted_password = None
678
 
        super(BzrGitHttpClient, self).__init__(str(url), *args, **kwargs)
 
678
        url = urlutils.split_segment_parameters(str(url))[0]
 
679
        super(BzrGitHttpClient, self).__init__(url, *args, **kwargs)
679
680
 
680
681
    def _http_request(self, url, headers=None, data=None,
681
682
                      allow_compression=False):
737
738
        return WrapResponse(response), read
738
739
 
739
740
 
 
741
def _git_url_and_path_from_transport(external_url):
 
742
    url, _ = urlutils.split_segment_parameters(external_url)
 
743
    return urlparse.urlsplit(url)
 
744
 
 
745
 
740
746
class RemoteGitControlDirFormat(GitControlDirFormat):
741
747
    """The .git directory control format."""
742
748
 
763
769
        """Open this directory.
764
770
 
765
771
        """
766
 
        # we dont grok readonly - git isn't integrated with transport.
767
 
        url = transport.base
768
 
        if url.startswith('readonly+'):
769
 
            url = url[len('readonly+'):]
770
 
        scheme = urlparse.urlsplit(transport.external_url())[0]
 
772
        split_url = _git_url_and_path_from_transport(transport.external_url())
771
773
        if isinstance(transport, GitSmartTransport):
772
774
            client = transport._get_client()
773
 
            client_path = transport._get_path()
774
 
        elif scheme in ("http", "https"):
 
775
        elif split_url.scheme in ("http", "https"):
775
776
            client = BzrGitHttpClient(transport)
776
 
            client_path, _ = urlutils.split_segment_parameters(transport._path)
777
 
        elif scheme == 'file':
 
777
        elif split_url.scheme in 'file':
778
778
            client = dulwich.client.LocalGitClient()
779
 
            client_path = transport.local_abspath('.')
780
779
        else:
781
780
            raise NotBranchError(transport.base)
782
781
        if not _found:
783
782
            pass  # TODO(jelmer): Actually probe for something
784
 
        return RemoteGitDir(transport, self, client, client_path)
 
783
        return RemoteGitDir(transport, self, client, split_url.path)
785
784
 
786
785
    def get_format_description(self):
787
786
        return "Remote Git Repository"