antoine 2003/07/11 01:33:11 Modified: src/main/org/apache/tools/ant/taskdefs/cvslib CvsTagDiff.java Log: PR: 21481 Solve issue with CvsTagDiff.java: rdiff command string adds single quote in wrong place Revision Changes Path 1.15 +78 -39 ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java Index: CvsTagDiff.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- CvsTagDiff.java 15 Jun 2003 20:26:57 -0000 1.14 +++ CvsTagDiff.java 11 Jul 2003 08:33:11 -0000 1.15 @@ -215,14 +215,51 @@ validate(); // build the rdiff command - String rdiff = "rdiff -s " + - (m_startTag != null ? ("-r " + m_startTag) : ("-D '" + m_startDate)) - + "' " - + (m_endTag != null ? ("-r " + m_endTag) : ("-D '" + m_endDate)) - + "' " + m_package; - log("Cvs command is " + rdiff, Project.MSG_VERBOSE); - setCommand(rdiff); - + addCommandArgument("rdiff"); + addCommandArgument("-s"); + if (m_startTag != null) { + addCommandArgument("-r"); + addCommandArgument(m_startTag); + } else + { + addCommandArgument("-D"); + addCommandArgument(m_startDate); + } + if (m_endTag != null) { + addCommandArgument("-r"); + addCommandArgument(m_endTag); + } else + { + addCommandArgument("-D"); + addCommandArgument(m_endDate); + } + addCommandArgument(m_package); + // force command not to be null + setCommand(""); + /* + StringBuffer rdiff = new StringBuffer(); + rdiff.append("rdiff"); + rdiff.append(" -s"); + if (m_startTag != null) { + rdiff.append(" -r"); + rdiff.append(" " + m_startTag); + } else + { + rdiff.append(" -D"); + rdiff.append(" '" + m_startDate + "'"); + } + if (m_endTag != null) { + rdiff.append(" -r"); + rdiff.append(" " + m_endTag); + } else + { + rdiff.append(" -D"); + rdiff.append(" '" + m_endDate + "'"); + } + rdiff.append(" " + m_package); + log("Cvs command is " + rdiff.toString(), Project.MSG_VERBOSE); + setCommand(rdiff.toString()); + */ File tmpFile = null; try { tmpFile = m_fileUtils.createTempFile("cvstagdiff", ".log", null); @@ -276,37 +313,39 @@ CvsTagEntry entry = null; while (null != line) { - line = line.substring(headerLength); - - if ((index = line.indexOf(FILE_IS_NEW)) != -1) { - // it is a new file - // set the revision but not the prevrevision - String filename = line.substring(0, index); - String rev = line.substring(index + FILE_IS_NEW.length()); - - entries.addElement(entry = new CvsTagEntry(filename, rev)); - log(entry.toString(), Project.MSG_VERBOSE); - } else if ((index = line.indexOf(FILE_HAS_CHANGED)) != -1) { - // it is a modified file - // set the revision and the prevrevision - String filename = line.substring(0, index); - int revSeparator = line.indexOf(" to ", index); - String prevRevision = - line.substring(index + FILE_HAS_CHANGED.length(), - revSeparator); - // 4 is " to " length - String revision = line.substring(revSeparator + 4); - - entries.addElement(entry = new CvsTagEntry(filename, - revision, - prevRevision)); - log(entry.toString(), Project.MSG_VERBOSE); - } else if ((index = line.indexOf(FILE_WAS_REMOVED)) != -1) { - // it is a removed file - String filename = line.substring(0, index); + if (line.length() > headerLength) { + line = line.substring(headerLength); - entries.addElement(entry = new CvsTagEntry(filename)); - log(entry.toString(), Project.MSG_VERBOSE); + if ((index = line.indexOf(FILE_IS_NEW)) != -1) { + // it is a new file + // set the revision but not the prevrevision + String filename = line.substring(0, index); + String rev = line.substring(index + FILE_IS_NEW.length()); + + entries.addElement(entry = new CvsTagEntry(filename, rev)); + log(entry.toString(), Project.MSG_VERBOSE); + } else if ((index = line.indexOf(FILE_HAS_CHANGED)) != -1) { + // it is a modified file + // set the revision and the prevrevision + String filename = line.substring(0, index); + int revSeparator = line.indexOf(" to ", index); + String prevRevision = + line.substring(index + FILE_HAS_CHANGED.length(), + revSeparator); + // 4 is " to " length + String revision = line.substring(revSeparator + 4); + + entries.addElement(entry = new CvsTagEntry(filename, + revision, + prevRevision)); + log(entry.toString(), Project.MSG_VERBOSE); + } else if ((index = line.indexOf(FILE_WAS_REMOVED)) != -1) { + // it is a removed file + String filename = line.substring(0, index); + + entries.addElement(entry = new CvsTagEntry(filename)); + log(entry.toString(), Project.MSG_VERBOSE); + } } line = reader.readLine(); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]