D4820: logtoprocess: sends the canonical command name to the subprocess

Yuya Nishihara yuya at tcha.org
Thu Oct 18 09:13:08 EDT 2018


> --- a/hgext/logtoprocess.py
> +++ b/hgext/logtoprocess.py
> @@ -40,6 +40,9 @@
>  import sys
>  
>  from mercurial import (
> +    dispatch,
> +    encoding,
> +    extensions,

Unused.

> @@ -110,6 +113,12 @@
>              script = self.config('logtoprocess', event)
>              if script:
>                  if msg:
> +
> +                    # extract the canonical command from the passed opts
> +                    canonical_command = opts.pop("canonical_command", None)
> +                    if canonical_command is None:
> +                        canonical_command = ""
> +
>                      # try to format the log message given the remaining
>                      # arguments
>                      try:
> @@ -134,7 +143,8 @@
>                      for key, value in opts.iteritems())
>                  env = dict(itertools.chain(procutil.shellenviron().items(),
>                                             msgpairs, optpairs),
> -                           EVENT=event, HGPID=str(os.getpid()))
> +                           EVENT=event, HGPID=str(os.getpid()),
> +                           LTP_COMMAND=canonical_command)

As I said before, `LTP_*` doesn't sound great. Can't we simply pass in
`canonical_command` as `OPT_CANONICAL_COMMAND`? If we really want to name
it other than `OPT_*`, please document it.

And I noticed there's no test. Can you add some?


More information about the Mercurial-devel mailing list