[TxMt] Mercurial bundle

Fred B. fredb7 at starflam.com
Wed May 3 22:16:26 UTC 2006


On 03 May 2006, at 20:48, Allan Odgaard wrote:

> On 3/5/2006, at 20:28, Fred B. wrote:
>
>>    eval "$TM_HG" log -v $HG_LIMIT --style "'$HG_STYLE'"  
>> $TM_SELECTED_FILES 2>&1
>
> I’m not sure why Ollivier gets an error, would indicate that there  
> is a ' in the value of HG_STYLE.

That would be strange as HG_STYLE="${TM_BUNDLE_SUPPORT}/map- 
cmdline.changelog" so
"/Library/Application Support/TextMate/Bundles/Mercurial.tmbundle/ 
Support/map-cmdline.changelog"
or
"~/Library/Application Support/TextMate/Bundles/Mercurial.tmbundle/ 
Support/map-cmdline.changelog"
If I'm not missing something. Or there is a single quote in the user  
name. Is such an horror possible? :)

(It was Brad, btw)

> However, there are some problems with this line. First,  
> $TM_SELECTED_FILES should be quoted. Second, the eval causes the  
> line to be re-interpreted after initial variable expansion, this is  
> why you get an error without the single quotes.

I didn't quote  $TM_SELECTED_FILES because it was not quoted in the  
svn bundle and I didn't have any problem even with paths with space  
in them. It works when quoted too, so I'll quote it anyway.

>
> So, the two solutions which spring to mind is 1) keep the single  
> quotes and escape any potential single quotes in HG_STYLE, if bash  
> wasn’t broken (to the best of my knowledge) that would make it "'$ 
> {HG_STYLE//'/'\''}'", or 2) use one level of indirection, like this:
>
>    dummy='$HG_STYLE'
>    eval "$TM_HG" log -v $HG_LIMIT --style "$dummy"  
> "$TM_SELECTED_FILES" 2>&1
>
> Now $dummy will expand to $HG_STYLE, and the eval will again expand  
> that to the actual value.

None of the solutions work.
The first needs or has an unneeded single quote. But as I don't have  
the problem here and don't even understand that escape nightmare I  
can't tell.
The second doesn't escape the path, as if there wasn't the dummy  
variable.

But, I just found that $HG_STYLE was 'too' escaped in the other line  
(without eval), maybe that was the problem.
I fixed that, quoted $TM_SELECTED_FILES and TM_HG. I leave it like  
that for now.

Brad could you try again?

Thanks

--
FredB



More information about the textmate mailing list