Mercurial > public > mercurial-scm > hg
comparison mercurial/chgserver.py @ 30726:dd897eb1699e
chg: send type information via S channel (BC)
Previously S channel is only used to send system commands. It will also be
used to send pager commands. So add a type parameter.
This breaks older chg clients. But chg and hg should always come from a
single commit and be packed into a single package. Supporting running
inconsistent versions of chg and hg seems to be unnecessarily complicated
with little benefit. So just make the change and assume people won't use
inconsistent chg with hg.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 06 Jan 2017 16:11:03 +0000 |
parents | 10b17ed9b591 |
children | 18eb63ec8475 |
comparison
equal
deleted
inserted
replaced
30725:c2bd2f77965b | 30726:dd897eb1699e |
---|---|
285 | 285 |
286 class channeledsystem(object): | 286 class channeledsystem(object): |
287 """Propagate ui.system() request in the following format: | 287 """Propagate ui.system() request in the following format: |
288 | 288 |
289 payload length (unsigned int), | 289 payload length (unsigned int), |
290 type, '\0', | |
290 cmd, '\0', | 291 cmd, '\0', |
291 cwd, '\0', | 292 cwd, '\0', |
292 envkey, '=', val, '\0', | 293 envkey, '=', val, '\0', |
293 ... | 294 ... |
294 envkey, '=', val | 295 envkey, '=', val |
295 | 296 |
296 and waits: | 297 if type == 'system', waits for: |
297 | 298 |
298 exitcode length (unsigned int), | 299 exitcode length (unsigned int), |
299 exitcode (int) | 300 exitcode (int) |
300 """ | 301 """ |
301 def __init__(self, in_, out, channel): | 302 def __init__(self, in_, out, channel): |
302 self.in_ = in_ | 303 self.in_ = in_ |
303 self.out = out | 304 self.out = out |
304 self.channel = channel | 305 self.channel = channel |
305 | 306 |
306 def __call__(self, cmd, environ, cwd): | 307 def __call__(self, cmd, environ, cwd, type='system'): |
307 args = [util.quotecommand(cmd), os.path.abspath(cwd or '.')] | 308 args = [type, util.quotecommand(cmd), os.path.abspath(cwd or '.')] |
308 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) | 309 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) |
309 data = '\0'.join(args) | 310 data = '\0'.join(args) |
310 self.out.write(struct.pack('>cI', self.channel, len(data))) | 311 self.out.write(struct.pack('>cI', self.channel, len(data))) |
311 self.out.write(data) | 312 self.out.write(data) |
312 self.out.flush() | 313 self.out.flush() |