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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-08 17:22:01 UTC
  • mfrom: (7320.1.1 fix-git-http)
  • Revision ID: breezy.the.bot@gmail.com-20190608172201-y5yz76s78yr076m4
Fix Git HTTP support.

Merged from https://code.launchpad.net/~jelmer/brz/fix-git-http/+merge/368582

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
        if host == "github.com":
165
165
            # GitHub requires we lie.
166
166
            # https://github.com/dulwich/dulwich/issues/562
167
 
            req.add_header("User-Agent", user_agent_for_github())
 
167
            headers["User-Agent"] = user_agent_for_github()
168
168
        elif host == "bazaar.launchpad.net":
169
169
            # Don't attempt Git probes against bazaar.launchpad.net; pad.lv/1744830
170
170
            raise brz_errors.NotBranchError(transport.base)
171
171
        resp = transport.request('GET', url, headers=headers)
172
172
        if resp.status in (404, 405):
173
173
            raise brz_errors.NotBranchError(transport.base)
174
 
        else:
175
 
            raise errors.InvalidHttpResponse(
 
174
        elif resp.status != 200:
 
175
            raise brz_errors.InvalidHttpResponse(
176
176
                url, 'Unable to handle http code %d' % resp.status)
177
177
 
178
 
        headers = resp.headers
179
 
        ct = headers.get("Content-Type")
 
178
        ct = resp.getheader("Content-Type")
180
179
        if ct is None:
181
180
            raise brz_errors.NotBranchError(transport.base)
182
181
        if ct.startswith("application/x-git"):