Hi!

I have recently found some time to hack Subversion tasks and followed
Clayton Harbour's suggestions to add those tasks a feature to save
their output to some specified file (following <exec> task's
implementation) and finally implemented the quiet attribute.

Things introduced:
 * AbstractSvnTask.Quiet property added. I have some doubts about this
idea, because not all Svn commands obey the --quiet parameter (e.g.
svn log). Nevertheless, <svn-checkout> and <svn-update> do work with
this parameter.
 * The default Quiet attribute value for SvnCheckoutTask and
SvnUpdateTask is false. I think it makes some sense (previously
SvnCheckoutTask had this option turned on by default). Now it is more
consistent. Should it be moved to AbstractSvnTask constructor,
perhaps?
 * AbstractSvnTask.Output and AbstractSvnTask.OutputAppend were added
(both overriding ExternalProgramBase properties). Their implementation
is directly taken from ExecTask.

I have tested those features with my own local test repo and they seem
to work fine. There's only one thing I am not 100% sure about: when I
use both "quiet" and "output" parameters at once the output file is
not created. It sounds perfectly good to me but maybe the preferred
result is the empty output file? What do you think about it?

I attach all the relevant patches (files reside in src\Tasks\Svn folder).

-- 
Marcin Hoppe
http://hopson.blogspot.com
Index: SvnUpdateTask.cs
===================================================================
RCS file: /cvsroot/nantcontrib/NAntContrib/src/Tasks/Svn/SvnUpdateTask.cs,v
retrieving revision 1.2
diff -r1.2 SvnUpdateTask.cs
60a61,71
>               #region Public Instance Constructors
> 
>               /// <summary>
>               /// Initialize the task, and set the default parameters.
>               /// </summary>
>               public SvnUpdateTask () {
>                       this.Quiet = false;
>               }
> 
>               #endregion Public Instance Constructors
> 
Index: SvnCheckoutTask.cs
===================================================================
RCS file: /cvsroot/nantcontrib/NAntContrib/src/Tasks/Svn/SvnCheckoutTask.cs,v
retrieving revision 1.5
diff -r1.5 SvnCheckoutTask.cs
69c69
<             this.Quiet = true;
---
>             this.Quiet = false;
88,98d87
<         /// Determines if the output should be minimized. The default is
<         /// <see langword="true" />.
<         /// </summary>
<         [TaskAttribute("quiet", Required=false)]
<         [BooleanValidator()]
<         public bool Quiet {
<             get { return ((Option)this.CommandOptions["quiet"]).IfDefined; }
<             set { this.SetCommandOption("quiet", "quiet", value); }
<         }
< 
<         /// <summary>
Index: AbstractSvnTask.cs
===================================================================
RCS file: /cvsroot/nantcontrib/NAntContrib/src/Tasks/Svn/AbstractSvnTask.cs,v
retrieving revision 1.8
diff -r1.8 AbstractSvnTask.cs
70a71,77
>               #region Private Instance Fields
> 
>               private FileInfo _output;
>               private bool _outputAppend;
> 
>               #endregion Private Instance Fields
> 
202a210,220
>               /// <summary>
>               /// Determines if the output should be minimized. The default is
>               /// <see langword="true" />.
>               /// </summary>
>               [TaskAttribute("quiet", Required=false)]
>               [BooleanValidator()]
>               public bool Quiet {
>                       get { return 
> ((Option)this.CommandOptions["quiet"]).IfDefined; }
>                       set { this.SetCommandOption("quiet", "quiet", value); }
>               }
> 
239a258,283
>               /// <summary>
>               /// The file to which the standard output will be redirected.
>               /// </summary>
>               /// <remarks>
>               /// By default, the standard output is redirected to the 
> console.
>               /// </remarks>
>               [TaskAttribute("output", Required=false)]
>               public override FileInfo Output {
>                       get { return _output; }
>                       set { _output = value; }
>               }
> 
>               /// <summary>
>               /// Gets or sets a value indicating whether output should be 
> appended 
>               /// to the output file. The default is <see langword="false" />.
>               /// </summary>
>               /// <value>
>               /// <see langword="true" /> if output should be appended to the 
> <see cref="Output" />; 
>               /// otherwise, <see langword="false" />.
>               /// </value>
>               [TaskAttribute("append", Required=false)]
>               public override bool OutputAppend {
>                       get { return _outputAppend; }
>                       set { _outputAppend = value; }
>               }
> 

Reply via email to