Mercurial > public > mercurial-scm > hg
comparison mercurial/httprepo.py @ 8055:027ac8ccfb5b
Merge with crew-stable
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 13 Apr 2009 14:36:55 +0200 |
parents | 016d6357646d b13cc762314a |
children | bbc24c0753a0 |
comparison
equal
deleted
inserted
replaced
8052:fe2a87a3d344 | 8055:027ac8ccfb5b |
---|---|
97 try: | 97 try: |
98 proto = resp.getheader('content-type') | 98 proto = resp.getheader('content-type') |
99 except AttributeError: | 99 except AttributeError: |
100 proto = resp.headers['content-type'] | 100 proto = resp.headers['content-type'] |
101 | 101 |
102 safeurl = url.hidepassword(self._url) | |
102 # accept old "text/plain" and "application/hg-changegroup" for now | 103 # accept old "text/plain" and "application/hg-changegroup" for now |
103 if not (proto.startswith('application/mercurial-') or | 104 if not (proto.startswith('application/mercurial-') or |
104 proto.startswith('text/plain') or | 105 proto.startswith('text/plain') or |
105 proto.startswith('application/hg-changegroup')): | 106 proto.startswith('application/hg-changegroup')): |
106 self.ui.debug(_("requested URL: '%s'\n") % cu) | 107 self.ui.debug(_("requested URL: '%s'\n") % url.hidepassword(cu)) |
107 raise error.RepoError(_("'%s' does not appear to be an hg repository") | 108 raise error.RepoError(_("'%s' does not appear to be an hg repository") |
108 % self._url) | 109 % safeurl) |
109 | 110 |
110 if proto.startswith('application/mercurial-'): | 111 if proto.startswith('application/mercurial-'): |
111 try: | 112 try: |
112 version = proto.split('-', 1)[1] | 113 version = proto.split('-', 1)[1] |
113 version_info = tuple([int(n) for n in version.split('.')]) | 114 version_info = tuple([int(n) for n in version.split('.')]) |
114 except ValueError: | 115 except ValueError: |
115 raise error.RepoError(_("'%s' sent a broken Content-Type " | 116 raise error.RepoError(_("'%s' sent a broken Content-Type " |
116 "header (%s)") % (self._url, proto)) | 117 "header (%s)") % (safeurl, proto)) |
117 if version_info > (0, 1): | 118 if version_info > (0, 1): |
118 raise error.RepoError(_("'%s' uses newer protocol %s") % | 119 raise error.RepoError(_("'%s' uses newer protocol %s") % |
119 (self._url, version)) | 120 (safeurl, version)) |
120 | 121 |
121 return resp | 122 return resp |
122 | 123 |
123 def do_read(self, cmd, **args): | 124 def do_read(self, cmd, **args): |
124 fp = self.do_cmd(cmd, **args) | 125 fp = self.do_cmd(cmd, **args) |