changeset 28514:0747ef2c4ab2

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.
author Jun Wu <quark@fb.com>
date Mon, 14 Mar 2016 11:23:04 +0000
parents 859af6e78368
children 491eabd0df79
files hgext/chgserver.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)))