Merge lp:~jelmer/brz/git-http-username into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/git-http-username
Merge into: lp:brz
Diff against target: 39 lines (+12/-3)
2 files modified
breezy/git/__init__.py (+8/-1)
breezy/git/remote.py (+4/-2)
To merge this branch: bzr merge lp:~jelmer/brz/git-http-username
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+363182@code.launchpad.net

Description of the change

Strip username from URLs before passing them to httplib.

This fixes access to Git HTTP repositories with authentication, such as bitbucket.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks! Should have a test that passes in a username.

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks. There is a long outstanding bug report about testing git over HTTP.

On 14 February 2019 11:53:08 GMT, Martin Packman <email address hidden> wrote:
>Review: Approve
>
>Thanks! Should have a test that passes in a username.
>--
>https://code.launchpad.net/~jelmer/brz/git-http-username/+merge/363182
>You are the owner of lp:~jelmer/brz/git-http-username.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/__init__.py'
--- breezy/git/__init__.py 2018-11-16 12:25:18 +0000
+++ breezy/git/__init__.py 2019-02-14 19:10:58 +0000
@@ -145,10 +145,17 @@
145class RemoteGitProber(Prober):145class RemoteGitProber(Prober):
146146
147 def probe_http_transport(self, transport):147 def probe_http_transport(self, transport):
148 # This function intentionally doesn't use any of the support code under
149 # breezy.git, since it's called for every repository that's
150 # accessed over HTTP, whether it's Git, Bzr or something else.
151 # Importing Dulwich and the other support code adds unnecessray slowdowns.
148 from .. import urlutils152 from .. import urlutils
149 base_url, _ = urlutils.split_segment_parameters(153 base_url, _ = urlutils.split_segment_parameters(
150 transport.external_url())154 transport.external_url())
151 url = urlutils.join(base_url, "info/refs") + "?service=git-upload-pack"155 url = urlutils.URL.from_string(base_url)
156 url.user = url.quoted_user = None
157 url.password = url.quoted_password = None
158 url = urlutils.join(str(url), "info/refs") + "?service=git-upload-pack"
152 from ..transport.http import Request159 from ..transport.http import Request
153 headers = {"Content-Type": "application/x-git-upload-pack-request",160 headers = {"Content-Type": "application/x-git-upload-pack-request",
154 "Accept": "application/x-git-upload-pack-result",161 "Accept": "application/x-git-upload-pack-result",
155162
=== modified file 'breezy/git/remote.py'
--- breezy/git/remote.py 2019-02-01 16:56:56 +0000
+++ breezy/git/remote.py 2019-02-14 19:10:58 +0000
@@ -660,8 +660,10 @@
660660
661 def __init__(self, transport, *args, **kwargs):661 def __init__(self, transport, *args, **kwargs):
662 self.transport = transport662 self.transport = transport
663 super(BzrGitHttpClient, self).__init__(663 url = urlutils.URL.from_string(transport.external_url())
664 transport.external_url(), *args, **kwargs)664 url.user = url.quoted_user = None
665 url.password = url.quoted_password = None
666 super(BzrGitHttpClient, self).__init__(str(url), *args, **kwargs)
665667
666 def _http_request(self, url, headers=None, data=None,668 def _http_request(self, url, headers=None, data=None,
667 allow_compression=False):669 allow_compression=False):

Subscribers

People subscribed via source and target branches