Browse Source

Allow reporting on multiple modules, aliased or not.

Also report the previous revision of deleted files when it is available.
PR: 21373
PR: 22877


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275624 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 21 years ago
parent
commit
c19671d815
3 changed files with 36 additions and 10 deletions
  1. +6
    -0
      WHATSNEW
  2. +26
    -9
      src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java
  3. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java

+ 6
- 0
WHATSNEW View File

@@ -209,6 +209,12 @@ Fixed bugs:
element tagdiff of the xml output element tagdiff of the xml output
Bugzilla Report 16081. Bugzilla Report 16081.


* <cvstagdiff> had a problem with aliased modules and with requests for multiple modules
Bugzilla Reports 21373 and 22877.

* <cvstagdiff> could not parse properly the revision number of new files with CVS 1.11.9 or higher
Bugzilla Report 24406.

* <fixcrlf> make fixcrlf create its temporary files in the default directory * <fixcrlf> make fixcrlf create its temporary files in the default directory
of FileUtils#createTempFile instead of the destination dir of fixcrlf. of FileUtils#createTempFile instead of the destination dir of fixcrlf.
Bugzilla Report 20870. Bugzilla Report 20870.


+ 26
- 9
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java View File

@@ -62,6 +62,8 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Vector; import java.util.Vector;
import java.util.StringTokenizer;

import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.AbstractCvsTask; import org.apache.tools.ant.taskdefs.AbstractCvsTask;
@@ -243,7 +245,11 @@ public class CvsTagDiff extends AbstractCvsTask {
addCommandArgument("-D"); addCommandArgument("-D");
addCommandArgument(myendDate); addCommandArgument(myendDate);
} }
addCommandArgument(mypackage);
// support multiple packages
StringTokenizer myTokenizer = new StringTokenizer(mypackage);
while (myTokenizer.hasMoreTokens()) {
addCommandArgument(myTokenizer.nextToken());
}
// force command not to be null // force command not to be null
setCommand(""); setCommand("");
File tmpFile = null; File tmpFile = null;
@@ -284,15 +290,21 @@ public class CvsTagDiff extends AbstractCvsTask {
reader = new BufferedReader(new FileReader(tmpFile)); reader = new BufferedReader(new FileReader(tmpFile));


// entries are of the form: // entries are of the form:
//CVS 1.11
// File module/filename is new; current revision 1.1 // File module/filename is new; current revision 1.1
//CVS 1.11.9
// File module/filename is new; cvstag_2003_11_03_2 revision 1.1
// or // or
// File module/filename changed from revision 1.4 to 1.6 // File module/filename changed from revision 1.4 to 1.6
// or // or
// File module/filename is removed; not included in // File module/filename is removed; not included in
// release tag SKINLF_12 // release tag SKINLF_12

//CVS 1.11.9
// File testantoine/antoine.bat is removed; TESTANTOINE_1 revision 1.1.1.1
//
// get rid of 'File module/" // get rid of 'File module/"
int headerLength = FILE_STRING.length() + mypackage.length() + 1;
String toBeRemoved = FILE_STRING + mypackage + "/";
int headerLength = toBeRemoved.length();
Vector entries = new Vector(); Vector entries = new Vector();


String line = reader.readLine(); String line = reader.readLine();
@@ -301,13 +313,13 @@ public class CvsTagDiff extends AbstractCvsTask {


while (null != line) { while (null != line) {
if (line.length() > headerLength) { if (line.length() > headerLength) {
line = line.substring(headerLength);
if (line.startsWith(toBeRemoved)) {
line = line.substring(headerLength);
} else {
line = line.substring(FILE_STRING.length());
}


if ((index = line.indexOf(FILE_IS_NEW)) != -1) { if ((index = line.indexOf(FILE_IS_NEW)) != -1) {
//CVS 1.11
//File apps/websphere/lib/something.jar is new; current revision 1.2
//CVS 1.11.9
//File apps/websphere/lib/something.jar is new; cvstag_2003_11_03_2 revision 1.2
// it is a new file // it is a new file
// set the revision but not the prevrevision // set the revision but not the prevrevision
String filename = line.substring(0, index); String filename = line.substring(0, index);
@@ -336,7 +348,12 @@ public class CvsTagDiff extends AbstractCvsTask {
} else if ((index = line.indexOf(FILE_WAS_REMOVED)) != -1) { } else if ((index = line.indexOf(FILE_WAS_REMOVED)) != -1) {
// it is a removed file // it is a removed file
String filename = line.substring(0, index); String filename = line.substring(0, index);
entry = new CvsTagEntry(filename);
String rev = null;
int indexrev = -1;
if ((indexrev = line.indexOf(REVISION, index)) != -1) {
rev = line.substring(indexrev + REVISION.length());
}
entry = new CvsTagEntry(filename, null, rev);
entries.addElement(entry); entries.addElement(entry);
log(entry.toString(), Project.MSG_VERBOSE); log(entry.toString(), Project.MSG_VERBOSE);
} }


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java View File

@@ -91,8 +91,11 @@ class CvsTagEntry {
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append(m_filename); buffer.append(m_filename);
if ((m_revision == null) && (m_prevRevision == null)) {
if ((m_revision == null)) {
buffer.append(" was removed"); buffer.append(" was removed");
if(m_prevRevision != null) {
buffer.append("; previous revision was ").append(m_prevRevision);
}
} else if (m_revision != null && m_prevRevision == null) { } else if (m_revision != null && m_prevRevision == null) {
buffer.append(" is new; current revision is ") buffer.append(" is new; current revision is ")
.append(m_revision); .append(m_revision);


Loading…
Cancel
Save