D1808: debugcommands: print out the editor that was searched for (post shlexsplit)

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Jan 5 14:39:37 EST 2018


spectral added inline comments.

INLINE COMMENTS

> krbullock wrote in debugcommands.py:1212
> In this patch, we end up printing something potentially different in the "checking" line than in the "can't find editor" line. That seems wrong. I think I'd rather we do the shlexsplit before writing the "checking commit editor..." message and print the fully-interpreted path there.

I'm not sure I agree, but I'm not sure I disagree either :)

Anything using this output (it shouldn't afaik, but the user report in #mercurial said that this broke Eclipse, maybe it was only looking at debuginstall to see if there were problems and not actually parsing these values...?) might end up with incorrect results.

- If we limit both of them to [0], it will end up with just the executable and miss the flags.  Maybe this is fine?  I don't know what Eclipse is doing with this command, basically, but I don't think we have BC guarantees on debug* commands.
- If either or both of them are not limited to just [0], then they have to be output as something like `"c:\foo\bar.exe" "-arg1" "-arg2"` to show where the actual word boundaries are; we can't do something like:

  `' '.join(shlexed_editor)`

We have to output it like that to avoid a similar problem, where instead of:

  [ui]
  editor = c:\foo\bar.exe -arg1 -arg2

the user wrote:

  [ui]
  editor = "c:\foo\bar.exe -arg1 -arg2"

(Currently, that problem is slightly more obvious, since the output is `checking commit editor... ("c:\foo\bar.exe -arg1 -arg2")`).

Basically... if we're ok with the rather mild BC break, I think it's probably fine to list only the editor, post-shlexsplit.  I don't know what the guarantees are here.  Anticipating that we're going to be OK with the output difference, since I can't see how things can actually correctly rely on the non-shlexsplit, non-findexe'd value we emit here (and thus have to assume that either nothing does, or they're already broken), I've made the change.

REPOSITORY
  rHG Mercurial

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

To: spectral, #hg-reviewers, krbullock
Cc: krbullock, mercurial-devel


More information about the Mercurial-devel mailing list