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

  • Committer: Jelmer Vernooij
  • Date: 2018-03-19 11:36:56 UTC
  • mto: (0.200.1868 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180319113656-1e9yg2sw27ajdhov
Work around bazaar.launchpad.net incorrectly responding to Git requests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
        url = urlutils.join(base_url, "info/refs") + "?service=git-upload-pack"
167
167
        from ...transport.http._urllib import HttpTransport_urllib, Request
168
168
        headers = {"Content-Type": "application/x-git-upload-pack-request"}
169
 
        if "github.com" in url:
 
169
        req = Request('GET', url, accepted_errors=[200, 403, 404, 405],
 
170
                      headers=headers)
 
171
        if req.get_host() == "github.com":
170
172
            # GitHub requires we lie. https://github.com/dulwich/dulwich/issues/562
171
173
            headers["User-agent"] = "git/Breezy/%s" % breezy_version
172
 
        req = Request('GET', url, accepted_errors=[200, 403, 404, 405],
173
 
                      headers=headers)
 
174
        elif req.get_host() == "bazaar.launchpad.net":
 
175
            # Don't attempt Git probes against bazaar.launchpad.net; pad.lv/1744830
 
176
            raise bzr_errors.NotBranchError(transport.base)
174
177
        req.follow_redirections = True
175
178
        resp = transport._perform(req)
176
179
        if resp.code in (404, 405):