Mercurial > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/chgserver.py Sun Jan 01 13:16:29 2017 +0100 +++ b/mercurial/chgserver.py Fri Jan 06 16:11:03 2017 +0000 @@ -287,13 +287,14 @@ """Propagate ui.system() request in the following format: payload length (unsigned int), + type, '\0', cmd, '\0', cwd, '\0', envkey, '=', val, '\0', ... envkey, '=', val - and waits: + if type == 'system', waits for: exitcode length (unsigned int), exitcode (int) @@ -303,8 +304,8 @@ self.out = out self.channel = channel - def __call__(self, cmd, environ, cwd): - args = [util.quotecommand(cmd), os.path.abspath(cwd or '.')] + def __call__(self, cmd, environ, cwd, type='system'): + args = [type, util.quotecommand(cmd), os.path.abspath(cwd or '.')] args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) data = '\0'.join(args) self.out.write(struct.pack('>cI', self.channel, len(data)))