chgserver: resolve relative path before sending via system channel
The chgserver may have a different cwd from the client because of the side
effect of "--cwd" and other possible os.chdir done by extensions. Therefore
relative paths can be misunderstood by the client.
This patch solves it by expanding relative cwd path to absolute one before
sending them via the 'S' channel. It can help chg to pass a testcase in
test-alias.t later.
--- a/hgext/chgserver.py Sat Mar 12 13:19:19 2016 -0800
+++ b/hgext/chgserver.py Mon Mar 14 11:23:04 2016 +0000
@@ -314,7 +314,7 @@
self.channel = channel
def __call__(self, cmd, environ, cwd):
- args = [util.quotecommand(cmd), cwd or '.']
+ args = [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)))