[darcs-users] darcs patch: Made --summary --xml-output work for other commands th...
Eric Kow
kowey at darcs.net
Fri Mar 27 21:58:31 UTC 2009
Reinier, could you take care of this one? Thanks!
On Fri, Mar 27, 2009 at 21:14:53 +0100, Florian Gilcher wrote:
> Fri Mar 27 18:51:25 CET 2009 Florian Gilcher <flo at andersground.net>
> * Made --summary --xml-output work for other commands then changes
>
> Makes print_dry_run_message_and_exit care for --summary --xml-output and print a summary-tag inside the return XML.
>
> Adapted the Algorithm from Changes.lhs and copied insert_before_lastline from there. (not nice, but works)
>
> Why?
> The manual suggests 'darcs pull --dry-run' to get the difference between 2 repositories. If you want to see the changes
> in detail, 'darcs pull --summary --dry-run' is the way to go. This works great, until --xml comes into play, which behaves
> different from the parameter in 'darcs changes' - it silently ignores --summary and prints no summary.
> This patch should fix that.
>
> How?
> Adapted the algorithm from Changes.lhs in Arguments.hs. This also involved copying insert_before_lastline (i didn't want
> to create an include-Dependency here). Maybe that should be factored out of changes anyways.
>
> Who?
> A bloody Haskell beginner. Please review the code and bury me under evil comments ;).
>
>
Made --summary --xml-output work for other commands then changes
----------------------------------------------------------------
> Florian Gilcher <flo at andersground.net>**20090327175125
> Ignore-this: d3b9af82419fb66b56e8b151e84de8be
>
> Makes print_dry_run_message_and_exit care for --summary --xml-output and print a summary-tag inside the return XML.
>
> Adapted the Algorithm from Changes.lhs and copied insert_before_lastline from there. (not nice, but works)
>
> ] hunk ./src/Darcs/Arguments.lhs 100
> import Progress ( beginTedious, endTedious, tediousSize, finishedOneIO )
> #endif
>
> -import Darcs.Hopefully ( PatchInfoAnd, info )
> -import Darcs.Patch ( RepoPatch, Patchy, showNicely, description )
> +import Darcs.Hopefully ( PatchInfoAnd, info, hopefullyM )
> +import Darcs.Patch ( RepoPatch, Patchy, showNicely, description, xml_summary )
> import Darcs.Patch.Info ( to_xml )
> import Darcs.Ordered ( FL, mapFL )
> import qualified Darcs.Patch ( summary )
> hunk ./src/Darcs/Arguments.lhs 119
> import Darcs.Repository.HashedRepo ( slurp_all_but_darcs )
> import Darcs.SlurpDirectory ( list_slurpy )
> import Darcs.Global ( darcsdir )
> -import Printer ( Doc, putDocLn, text, vsep, ($$), vcat )
> +import ByteStringUtils ( linesPS )
> +import Printer ( Doc, putDocLn, text, vsep, ($$), vcat, packedString, renderPS, prefix )
> import URL ( pipeliningEnabledByDefault )
> #include "impossible.h"
>
> hunk ./src/Darcs/Arguments.lhs 1111
> putDocLn $ put_mode
> where put_mode = if XMLOutput `elem` opts
> then (text "<patches>" $$
> - vcat (mapFL (to_xml . info) patches) $$
> + vcat (mapFL (indent . xml_info) patches) $$
> text "</patches>")
> else (vsep $ mapFL (showFriendly opts) patches)
> putInfo = if XMLOutput `elem` opts then \_ -> return () else putDocLn
> hunk ./src/Darcs/Arguments.lhs 1115
> + xml_info pl
> + | Summary `elem` opts = xml_with_summary pl
> + | otherwise = (to_xml . info) pl
> +
> + 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 " "
> +
> +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
>
> \end{code}
>
>
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090327/29949cf6/attachment.pgp>
More information about the darcs-users
mailing list