comparison mercurial/httprepo.py @ 4016:a195f11ed1a2

sync with -stable
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 02 Jan 2007 22:40:52 +0100
parents 6b4127c7d52a d1e31d7f7d44
children 9210fba03d16
comparison
equal deleted inserted replaced
4007:20da40cc1c73 4016:a195f11ed1a2
254 proto = resp.getheader('content-type') 254 proto = resp.getheader('content-type')
255 except AttributeError: 255 except AttributeError:
256 proto = resp.headers['content-type'] 256 proto = resp.headers['content-type']
257 257
258 # accept old "text/plain" and "application/hg-changegroup" for now 258 # accept old "text/plain" and "application/hg-changegroup" for now
259 if not proto.startswith('application/mercurial') and \ 259 if not proto.startswith('application/mercurial-') and \
260 not proto.startswith('text/plain') and \ 260 not proto.startswith('text/plain') and \
261 not proto.startswith('application/hg-changegroup'): 261 not proto.startswith('application/hg-changegroup'):
262 raise hg.RepoError(_("'%s' does not appear to be an hg repository") % 262 raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
263 self._url) 263 self._url)
264 264
265 if proto.startswith('application/mercurial'): 265 if proto.startswith('application/mercurial-'):
266 version = proto[22:] 266 try:
267 if float(version) > 0.1: 267 version = float(proto[22:])
268 except ValueError:
269 raise hg.RepoError(_("'%s' sent a broken Content-type "
270 "header (%s)") % (self._url, proto))
271 if version > 0.1:
268 raise hg.RepoError(_("'%s' uses newer protocol %s") % 272 raise hg.RepoError(_("'%s' uses newer protocol %s") %
269 (self._url, version)) 273 (self._url, version))
270 274
271 return resp 275 return resp
272 276