[PATCH 1 of 2 STABLE V3] util: add "shellsplit()" to centralize the logic to split command line

Mads Kiilerich mads at kiilerich.com
Sun Dec 7 09:23:30 CST 2014


Thanks for summarizing the background for this tricky issue. I can see 
how something like these changes are the only way to move forward with 
extdiff.

The changes are however also big and tricky and adds complexity. I get 
the feeling that it probably not will be the last time we find issues in 
this area.

Could we take a step back and do things differently and thus avoid the 
problem? Could we avoid parsing commandlines and options? Couldn't we 
just maintain 'cmdline' as a string where we can substitute or add 
parameters when necessary? (I guess that pretty much also is what Yuya 
suggested.)

As far as I can see, we only parse the command line and options in order 
to always have the command path separate from the options. And it seems 
like the only _real_ reason we do that is that if the configuration for 
CMD doesn't have any options, then we must append the value of 
diff-tools.CMD.diffargs / merge-tools.CMD.diffargs . shlex.split might 
be imperfect but should be capable of telling us whether there are any 
options or not.

/Mads



More information about the Mercurial-devel mailing list