/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-05-28 23:50:18 UTC
  • mfrom: (7296.2.9 urllib3-like)
  • Revision ID: breezy.the.bot@gmail.com-20190528235018-wpu2geti8rd2t9ji
Use a more urllib3-like API for HTTP requests.

Merged from https://code.launchpad.net/~jelmer/brz/urllib3-like/+merge/367618

Show diffs side-by-side

added added

removed removed

Lines of Context:
692
692
            `redirect_location` properties, and `read` is a consumable read
693
693
            method for the response data.
694
694
        """
695
 
        from breezy.transport.http import Request
696
695
        headers['User-agent'] = user_agent_for_github()
697
696
        headers["Pragma"] = "no-cache"
698
697
        if allow_compression:
700
699
        else:
701
700
            headers["Accept-Encoding"] = "identity"
702
701
 
703
 
        request = Request(
 
702
        response = self.transport.request(
704
703
            ('GET' if data is None else 'POST'),
705
 
            url, data, headers,
706
 
            accepted_errors=[200, 404])
707
 
        request.follow_redirections = True
708
 
 
709
 
        response = self.transport._perform(request)
710
 
 
711
 
        if response.code == 404:
 
704
            body=data,
 
705
            headers=headers, retries=8)
 
706
 
 
707
        if response.status == 404:
712
708
            raise NotGitRepository()
713
 
        elif response.code != 200:
 
709
        elif response.status != 200:
714
710
            raise GitProtocolError("unexpected http resp %d for %s" %
715
711
                                   (response.code, url))
716
712