[PATCH] chgserver: resolve relative path before sending via system channel
yuya at tcha.org
Sat Mar 12 10:02:06 EST 2016
On Sat, 12 Mar 2016 05:12:36 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1457754336 0
> # Sat Mar 12 03:45:36 2016 +0000
> # Node ID 82abdd91e22e218fbf17d032cbb15be72252fb28
> # Parent 3bd824c35cd84e5259e65be611a40ad2f8080922
> 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.
Ah, good point.
> diff --git a/hgext/chgserver.py b/hgext/chgserver.py
> --- a/hgext/chgserver.py
> +++ b/hgext/chgserver.py
> @@ -243,6 +243,8 @@
> csystem = self._csystem
> csystem = defaultcsystem
> + if cwd is not None and not os.path.isabs(cwd):
> + cwd = os.path.realpath(cwd)
If the purpose of isabs(cwd) is to avoid the cost of symlink resolution,
you can simply use abspath(cwd).
Other than that, this looks good to me.
More information about the Mercurial-devel