antoine 2004/07/17 09:11:58
Modified: . Tag: ANT_16_BRANCH WHATSNEW
docs/manual/CoreTypes Tag: ANT_16_BRANCH selectors.html
src/main/org/apache/tools/ant/types/selectors Tag:
ANT_16_BRANCH DifferentSelector.java
Log:
Merge from HEAD
Revision Changes Path
No revision
No revision
1.503.2.120 +2 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.503.2.119
retrieving revision 1.503.2.120
diff -u -r1.503.2.119 -r1.503.2.120
--- WHATSNEW 17 Jul 2004 15:13:47 -0000 1.503.2.119
+++ WHATSNEW 17 Jul 2004 16:11:58 -0000 1.503.2.120
@@ -7,6 +7,8 @@
Other changes:
--------------
+* New attribute ignorecontents for <different> selector
+
Fixed bugs:
-----------
No revision
No revision
1.15.2.7 +10 -1 ant/docs/manual/CoreTypes/selectors.html
Index: selectors.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTypes/selectors.html,v
retrieving revision 1.15.2.6
retrieving revision 1.15.2.7
diff -u -r1.15.2.6 -r1.15.2.7
--- selectors.html 26 Apr 2004 19:20:24 -0000 1.15.2.6
+++ selectors.html 17 Jul 2004 16:11:58 -0000 1.15.2.7
@@ -300,7 +300,8 @@
<li> Files with different lengths are different.
<li> If <tt>ignoreFileTimes</tt> is turned off, then differing file
timestamps will cause files to be regarded as different.
- <li> Finally a byte-for-byte check is run against the two files
+ <li> Unless<tt>ignoreContents</tt> is set to true, a byte-for-byte check
is run
+ against the two files
</ol>
This is a useful selector to work with programs and tasks that don't
handle
@@ -339,6 +340,14 @@
<td valign="top">ignoreFileTimes</td>
<td valign="top">Whether to use file times in the comparison or not.
Default is true (time differences are ignored).
+ </td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">ignoreContents</td>
+ <td valign="top">Whether to do a byte per byte compare.
+ Default is false (contents are compared).
+ Since ant 1.6.3
</td>
<td valign="top" align="center">No</td>
</tr>
No revision
No revision
1.8.2.5 +26 -11
ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java
Index: DifferentSelector.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java,v
retrieving revision 1.8.2.4
retrieving revision 1.8.2.5
diff -u -r1.8.2.4 -r1.8.2.5
--- DifferentSelector.java 9 Mar 2004 17:01:56 -0000 1.8.2.4
+++ DifferentSelector.java 17 Jul 2004 16:11:58 -0000 1.8.2.5
@@ -25,10 +25,14 @@
/**
* This selector selects files against a mapped set of target files,
selecting
- * all those files which are different. A byte-by-byte comparision is
performed
- * on equal length files; files with different lengths are deemed different
- * automatically; files with identical timestamps are viewed as matching by
+ * all those files which are different.
+ * Files with different lengths are deemed different
+ * automatically
+ * Files with identical timestamps are viewed as matching by
* default, unless you specify otherwise.
+ * Contents are compared if the lengths are the same
+ * and the timestamps are ignored or the same,
+ * except if you decide to ignore contents to gain speed.
* <p>
* This is a useful selector to work with programs and tasks that don't
handle
* dependency checking properly; Even if a predecessor task always creates
its
@@ -47,6 +51,7 @@
private FileUtils fileUtils = FileUtils.newFileUtils();
private boolean ignoreFileTimes = true;
+ private boolean ignoreContents = false;
/**
@@ -56,7 +61,14 @@
public void setIgnoreFileTimes(boolean ignoreFileTimes) {
this.ignoreFileTimes = ignoreFileTimes;
}
-
+ /**
+ * This flag tells the selector to ignore contents
+ * @param ignoreContents if true ignore contents
+ * @since ant 1.6.3
+ */
+ public void setIgnoreContents(boolean ignoreContents) {
+ this.ignoreContents = ignoreContents;
+ }
/**
* this test is our selection test that compared the file with the
destfile
* @param srcfile the source file
@@ -86,13 +98,16 @@
return true;
}
}
-
- //here do a bulk comparison
- try {
- return !fileUtils.contentEquals(srcfile, destfile);
- } catch (IOException e) {
- throw new BuildException("while comparing " + srcfile + " and "
- + destfile, e);
+ if (!ignoreContents) {
+ //here do a bulk comparison
+ try {
+ return !fileUtils.contentEquals(srcfile, destfile);
+ } catch (IOException e) {
+ throw new BuildException("while comparing " + srcfile + "
and "
+ + destfile, e);
+ }
+ } else {
+ return false;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]