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

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Mon Oct 22 08:53:02 EDT 2018


lothiraldan added a comment.


  In https://phab.mercurial-scm.org/D4820#77055, @yuja wrote:
  
  > > - 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 = ""
  > >  +
  > > 
  > >   1. try to format the log message given the remaining
  > >   2. 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.
  
  
  I misunderstood your previous comment, the canonical command is now sent as `OPT_CANONICAL_COMMAND`, I still need to process it in a dedicated manner and I've detailed why in the comment associated.
  
  > And I noticed there's no test. Can you add some?
  
  I have updated the patch with a test and removed the unused imports.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4820

To: lothiraldan, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list