Author: bodewig
Date: Sun Mar 23 10:17:32 2014
New Revision: 1580482

URL: http://svn.apache.org/r1580482
Log:
add a new quiet attribute to <get>, GitHub PR by hydra1983, closes #1

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/manual/Tasks/get.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1580482&r1=1580481&r2=1580482&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sun Mar 23 10:17:32 2014
@@ -140,6 +140,10 @@ Other changes:
    have different base directories.
    Bugzilla Report 48621
 
+ * <get> has a quiet attribute that makes the task log errors only
+   when enabled.
+   GitHub Pull Request #1
+
 Changes from Ant 1.9.2 TO Ant 1.9.3
 ===================================
 

Modified: ant/core/trunk/manual/Tasks/get.html
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/manual/Tasks/get.html?rev=1580482&r1=1580481&r2=1580482&view=diff
==============================================================================
--- ant/core/trunk/manual/Tasks/get.html (original)
+++ ant/core/trunk/manual/Tasks/get.html Sun Mar 23 10:17:32 2014
@@ -72,6 +72,11 @@ plain text' authentication is used. This
     <td align="center" valign="top">No; default "false"</td>
   </tr>
   <tr>
+    <td valign="top">quiet</td>
+    <td valign="top">Log errors only.(&quot;true&quot;/&quot;false&quot;).</td>
+    <td align="center" valign="top">No; default "false"</td>
+  </tr>
+  <tr>
     <td valign="top">ignoreerrors</td>
     <td valign="top">Log errors but don't treat as fatal.</td>
     <td align="center" valign="top">No; default "false"</td>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java?rev=1580482&r1=1580481&r2=1580482&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java Sun Mar 23 
10:17:32 2014
@@ -74,6 +74,7 @@ public class Get extends Task {
     private Resources sources = new Resources();
     private File destination; // required
     private boolean verbose = false;
+    private boolean quiet = false;
     private boolean useTimestamp = false; //off by default
     private boolean ignoreErrors = false;
     private String uname = null;
@@ -253,6 +254,13 @@ public class Get extends Task {
         return getThread.wasSuccessful();
     }
 
+    @Override
+    public void log(String msg, int msgLevel) {
+        if (!quiet || msgLevel >= Project.MSG_ERR) {
+            super.log(msg, msgLevel);
+        }
+    }
+
     /**
      * Check the attributes.
      */
@@ -332,6 +340,16 @@ public class Get extends Task {
     }
 
     /**
+     * If true, set default log level to Project.MSG_ERR.
+     *
+     * @param v if "true" then be quiet
+     * @since Ant 1.9.4
+     */
+    public void setQuiet(boolean v){
+        this.quiet = v;
+    }
+
+    /**
      * If true, log errors but do not treat as fatal.
      *
      * @param v if "true" then don't report download errors up to ant


Reply via email to