[darcs-users] darcs patch: Made --summary --xml-output work for other commands th...

Florian Gilcher darcs-lists at andersground.net
Sat Mar 28 23:28:05 UTC 2009


On Mar 28, 2009, at 9:59 PM, Reinier Lamers wrote:

> Hi all,
>
> I'd say: amend to move the insert_before_lastline to the Printer  
> module in
> src/Printer.lhs, and import it from there to Changes.lhs and  
> Arguments.lhs.
> For the rest it's fine.
>
> It might be nice to send a patch to add documentation of this as  
> well. It's
> most relevant for people implementing tools on top of darcs.
>

I will have a look into it.

>
>> +
>> +           xml_with_summary hp
>> +               | Just p <- hopefullyM hp = insert_before_lastline
>> +                                            (to_xml $ info hp)  
>> (indent $
>> xml_summary p) +           xml_with_summary hp = to_xml (info hp)
>> +           indent = prefix "    "
>
> Is that a pattern guard? Do those work with GHC 6.6? Anyway, it  
> appears to be
> cut n pasted from Changes.lhs so it works.

I didn't fully understand it, but someone seemed to know what he was  
doing ;).

>> +insert_before_lastline :: Doc -> Doc -> Doc
>> +insert_before_lastline a b =
>> +    case reverse $ map packedString $ linesPS $ renderPS a of
>> +    (ll:ls) -> vcat (reverse ls) $$ b $$ ll
>> +    [] -> impossible
>
> Shouldn't we move this to src/Printer.lhs? That's where the commonly  
> used
> functions on Doc's reside.

I just tried that to improve that. Turns out that "impossible" is  
undefined in
Printer.lhs (happens), but you cannot include "impossible.h" into  
Printer,
because that would create a circular dependency with Darcs.Bug. I have  
no quick
idea how to solve this or whether darcs has an alternative way of  
reporting bugs.

Regards,
Florian



More information about the darcs-users mailing list