/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: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
"""A GIT branch and repository format implementation for bzr."""
24
24
 
 
25
from __future__ import absolute_import
 
26
 
25
27
import os
26
28
import sys
27
29
 
178
180
            # GitHub requires we lie.
179
181
            # https://github.com/dulwich/dulwich/issues/562
180
182
            headers["User-Agent"] = user_agent_for_github()
 
183
        elif host == "bazaar.launchpad.net":
 
184
            # Don't attempt Git probes against bazaar.launchpad.net; pad.lv/1744830
 
185
            raise brz_errors.NotBranchError(transport.base)
181
186
        resp = transport.request('GET', url, headers=headers)
182
187
        if resp.status in (404, 405):
183
188
            raise brz_errors.NotBranchError(transport.base)
184
 
        elif resp.status == 400 and resp.reason == 'no such method: info':
185
 
            # hgweb :(
186
 
            raise brz_errors.NotBranchError(transport.base)
187
189
        elif resp.status != 200:
188
 
            raise brz_errors.UnexpectedHttpStatus(url, resp.status)
 
190
            raise brz_errors.InvalidHttpResponse(
 
191
                url, 'Unable to handle http code %d' % resp.status)
189
192
 
190
193
        ct = resp.getheader("Content-Type")
191
194
        if ct and ct.startswith("application/x-git"):
420
423
def loggerhead_git_hook(branch_app, environ):
421
424
    branch = branch_app.branch
422
425
    config_stack = branch.get_config_stack()
423
 
    if not config_stack.get('git.http'):
 
426
    if config_stack.get('http_git'):
424
427
        return None
425
428
    from .server import git_http_hook
426
429
    return git_http_hook(branch, environ['REQUEST_METHOD'],