Mercurial > hg-stable
comparison hgext/chgserver.py @ 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 | ff5f923fca3c |
children | 3bf2892f685f |
comparison
equal
deleted
inserted
replaced
28513:859af6e78368 | 28514:0747ef2c4ab2 |
---|---|
312 self.in_ = in_ | 312 self.in_ = in_ |
313 self.out = out | 313 self.out = out |
314 self.channel = channel | 314 self.channel = channel |
315 | 315 |
316 def __call__(self, cmd, environ, cwd): | 316 def __call__(self, cmd, environ, cwd): |
317 args = [util.quotecommand(cmd), cwd or '.'] | 317 args = [util.quotecommand(cmd), os.path.abspath(cwd or '.')] |
318 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) | 318 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) |
319 data = '\0'.join(args) | 319 data = '\0'.join(args) |
320 self.out.write(struct.pack('>cI', self.channel, len(data))) | 320 self.out.write(struct.pack('>cI', self.channel, len(data))) |
321 self.out.write(data) | 321 self.out.write(data) |
322 self.out.flush() | 322 self.out.flush() |