[PATCH 2 of 2] hooks: allow Unix style environment variables on external Windows hooks

Yuya Nishihara yuya at tcha.org
Thu Jun 28 07:53:05 EDT 2018


On Wed, 27 Jun 2018 08:44:27 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1498969929 14400
> #      Sun Jul 02 00:32:09 2017 -0400
> # Node ID 6d206e4742d6f31246d0e234add03436ac429ebf
> # Parent  7ac9de5a8826fc95864ee4ba844eb8b5c9e71332
> hooks: allow Unix style environment variables on external Windows hooks

> +    if pycompat.iswindows:
> +        environ = procutil.shellenviron(env)
> +        cmd = util.platform.shelltocmdexe(cmd, environ)

util.platform isn't intended to be a re-export of the platform module.
Instead, we can add a wrapper function to procutil:

  if windows:
      def shelltonative(cmd, env):
          return platform.shelltocmdexe(cmd, shellenviron(env))
  else:
      def shelltonative(cmd, env):
          return cmd

Can you send a follow up?


More information about the Mercurial-devel mailing list