Mercurial > hg
comparison mercurial/wireprotoserver.py @ 36798:7574c8173d5e
wireprotoserver: check if command available before calling it
The previous behavior was just plain wrong. I have no clue how it
landed. My guess is a merge conflict resolution gone wrong on my
end a few weeks ago.
Differential Revision: https://phab.mercurial-scm.org/D2716
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 06 Mar 2018 15:02:53 -0800 |
parents | 7bf80d9d9543 |
children | c638a13093cf |
comparison
equal
deleted
inserted
replaced
36797:d4c760c997cd | 36798:7574c8173d5e |
---|---|
233 yield name | 233 yield name |
234 | 234 |
235 for chunk in gen: | 235 for chunk in gen: |
236 yield chunk | 236 yield chunk |
237 | 237 |
238 rsp = wireproto.dispatch(repo, proto, cmd) | |
239 | |
240 if not wireproto.commands.commandavailable(cmd, proto): | 238 if not wireproto.commands.commandavailable(cmd, proto): |
241 req.respond(HTTP_OK, HGERRTYPE, | 239 req.respond(HTTP_OK, HGERRTYPE, |
242 body=_('requested wire protocol command is not available ' | 240 body=_('requested wire protocol command is not available ' |
243 'over HTTP')) | 241 'over HTTP')) |
244 return [] | 242 return [] |
243 | |
244 rsp = wireproto.dispatch(repo, proto, cmd) | |
245 | 245 |
246 if isinstance(rsp, bytes): | 246 if isinstance(rsp, bytes): |
247 req.respond(HTTP_OK, HGTYPE, body=rsp) | 247 req.respond(HTTP_OK, HGTYPE, body=rsp) |
248 return [] | 248 return [] |
249 elif isinstance(rsp, wireprototypes.bytesresponse): | 249 elif isinstance(rsp, wireprototypes.bytesresponse): |