mercurial/httprepo.py
branchstable
changeset 14503 4e958f2a193f
parent 13115 bda5f35fbf67
child 14504 c59968e8b579
equal deleted inserted replaced
14502:deb82fdda94e 14503:4e958f2a193f
   105             self.ui.status(_('real URL is %s\n') % resp_url)
   105             self.ui.status(_('real URL is %s\n') % resp_url)
   106         self._url = resp_url
   106         self._url = resp_url
   107         try:
   107         try:
   108             proto = resp.getheader('content-type')
   108             proto = resp.getheader('content-type')
   109         except AttributeError:
   109         except AttributeError:
   110             proto = resp.headers['content-type']
   110             proto = resp.headers.get('content-type', '')
   111 
   111 
   112         safeurl = url.hidepassword(self._url)
   112         safeurl = url.hidepassword(self._url)
   113         # accept old "text/plain" and "application/hg-changegroup" for now
   113         # accept old "text/plain" and "application/hg-changegroup" for now
   114         if not (proto.startswith('application/mercurial-') or
   114         if not (proto.startswith('application/mercurial-') or
   115                 proto.startswith('text/plain') or
   115                 proto.startswith('text/plain') or
   116                 proto.startswith('application/hg-changegroup')):
   116                 proto.startswith('application/hg-changegroup')):
   117             self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu))
   117             self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu))
   118             raise error.RepoError(
   118             raise error.RepoError(
   119                 _("'%s' does not appear to be an hg repository:\n"
   119                 _("'%s' does not appear to be an hg repository:\n"
   120                   "---%%<--- (%s)\n%s\n---%%<---\n")
   120                   "---%%<--- (%s)\n%s\n---%%<---\n")
   121                 % (safeurl, proto, resp.read()))
   121                 % (safeurl, proto or 'no content-type', resp.read()))
   122 
   122 
   123         if proto.startswith('application/mercurial-'):
   123         if proto.startswith('application/mercurial-'):
   124             try:
   124             try:
   125                 version = proto.split('-', 1)[1]
   125                 version = proto.split('-', 1)[1]
   126                 version_info = tuple([int(n) for n in version.split('.')])
   126                 version_info = tuple([int(n) for n in version.split('.')])