On Thu, Sep 04, 2008 at 03:49:20PM -0700, Simon Michael wrote:
> Thu Aug  7 03:07:01 PDT 2008  Simon Michael <[EMAIL PROTECTED]>
>   * make -q have an effect with darcs changes (show just patch names)
>
> Currently the --quiet flag has no effect on darcs changes. This is
> inconsistent with the --help docs, and an opportunity; this patch makes it
> show just the patch names, one per line. I find this surprisingly useful
> for scripting and for getting a quick handle on what's going on. If
> accepted we should consider doing in other places where appropriate.

I'm not really convinced of this as a feature, and I'm also not sure
that I like -q meaning yet another output.  But if you want to amend
this so it'll apply cleanly, I'll try it out.

David

> hunk ./src/Darcs/Commands/Changes.lhs 31
> -import Darcs.Arguments ( DarcsFlag(Context, MachineReadable, Interactive,
> -                                   OnlyChangesToFiles, Count, NumberPatches,
> -                                  XMLOutput, Summary, Reverse, Verbose, 
> Debug),
> +import Darcs.Arguments ( DarcsFlag(Context, HumanReadable, MachineReadable,
> +                                   Interactive, OnlyChangesToFiles, Count,
> +                                   NumberPatches, XMLOutput, Summary,
> +                                   Reverse, Verbose, Debug),
> ]
> :
> hunk ./src/Darcs/Commands/Changes.lhs 33
> -                                  XMLOutput, Summary, Reverse, Verbose, 
> Debug),
> +                                   XMLOutput, Summary, Reverse, Debug,
> +                                   Verbose, Quiet),
> hunk ./src/Darcs/Commands/Changes.lhs 204
>      | Summary `elem` opts || Verbose `elem`  opts =
>             vsep (map (number_patch change_with_summary) pis)
>          $$ errstring
> +    | Quiet `elem` opts = vcat (map (number_patch just_the_name) pis)
> +               $$ errstring
>      | otherwise = vsep (map (number_patch description) pis)
>                 $$ errstring
>      where change_with_summary hp
> hunk ./src/Darcs/Commands/Changes.lhs 241
>                      gn n (b:<:bs) | seq n (info b) == iy = Just n
>                                    | otherwise = gn (n+1) bs
>                      gn _ NilRL = Nothing
> +          just_the_name = text . firstline . renderString . description
> +          firstline s = lines s !! 1

You should definitely at a minimum rewrite this firstline so that it
won't crash if we should ever change description to sometimes create a
single-line description.  A robust example of firstline would be

firstline s = concat $ take 1 $ drop 1 $ lines s

which won't crash regardless of its input.

Even better (if this is seen as useful) would be to write a
shortDescription function rather than munging the text output of
description.

David
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to