ASF Bugzilla – Attachment 10653 Details for
Bug 27419
[PATCH] Add support for rlog and tag ranges to CvsChangeLog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Code patch
code.patch (text/plain), 7.58 KB, created by
Rob van Oostrum
on 2004-03-03 21:52:34 UTC
(
hide
)
Description:
Code patch
Filename:
MIME Type:
Creator:
Rob van Oostrum
Created:
2004-03-03 21:52:34 UTC
Size:
7.58 KB
patch
obsolete
>Index: src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java,v >retrieving revision 1.22.2.3 >diff -u -r1.22.2.3 ChangeLogParser.java >--- src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java 9 Feb 2004 22:12:23 -0000 1.22.2.3 >+++ src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java 3 Mar 2004 21:30:31 -0000 >@@ -53,11 +53,32 @@ > private String m_comment; > private String m_revision; > private String m_previousRevision; >+ private boolean m_remote = false; >+ private String m_module; > > private int m_status = GET_FILE; > > /** rcs entries */ > private final Hashtable m_entries = new Hashtable(); >+ >+ /** >+ * Default constructor for backwards compatibility >+ * >+ */ >+ public ChangeLogParser() { >+ super(); >+ } >+ >+ /** >+ * Default constructor for remote-capable ChangeLogTask >+ * >+ * @param remote indicates whether cvs log or cvs rlog was used >+ */ >+ public ChangeLogParser(boolean remote, String module) { >+ super(); >+ m_remote = remote; >+ m_module = module; >+ } > > /** > * Get a list of rcs entries as an array. >@@ -135,9 +156,22 @@ > * @param line the line > */ > private void processFile(final String line) { >- if (line.startsWith("Working file:")) { >+ if (!m_remote && line.startsWith("Working file:")) { > m_file = line.substring(14, line.length()); >- m_status = GET_REVISION; >+ m_status = GET_REVISION; >+ } >+ else if (m_remote && line.startsWith("RCS file:")) { >+ // exclude the part of the RCS filename up to and including the module name (and the path separator) >+ int startOfFilename = line.indexOf(m_module) + m_module.length() + 1; >+ >+ // exclude the ,v extension of the RCS filename >+ int endOfFilename = line.indexOf(",v"); >+ >+ // the resulting filename has the path relative to the root of the module specified >+ m_file = line.substring(startOfFilename, endOfFilename); >+ >+ // update the parser status >+ m_status = GET_REVISION; > } > } > >Index: src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java,v >retrieving revision 1.25.2.4 >diff -u -r1.25.2.4 ChangeLogTask.java >--- src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java 9 Feb 2004 22:12:23 -0000 1.25.2.4 >+++ src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java 3 Mar 2004 21:30:31 -0000 >@@ -28,12 +28,11 @@ > import java.util.Enumeration; > import java.util.Properties; > import java.util.Vector; >+ > import org.apache.tools.ant.BuildException; > import org.apache.tools.ant.DirectoryScanner; > import org.apache.tools.ant.Project; >-import org.apache.tools.ant.taskdefs.Execute; > import org.apache.tools.ant.taskdefs.AbstractCvsTask; >-import org.apache.tools.ant.types.Commandline; > import org.apache.tools.ant.types.FileSet; > > /** >@@ -85,6 +84,15 @@ > > /** The latest date at which to stop processing entries. */ > private Date m_stop; >+ >+ /** The tag at which to start processing revisions */ >+ private String m_startTag; >+ >+ /** The tag at which to stop processing revisions */ >+ private String m_endTag; >+ >+ /** Determines whether log (false) or rlog (true) is used */ >+ private boolean m_remote = false; > > /** > * Filesets containing list of files against which the cvs log will be >@@ -152,8 +160,30 @@ > public void setEnd(final Date stop) { > m_stop = stop; > } >+ >+ /** >+ * Set the tag at which the changelog should start. >+ * >+ * @param startTag The tag at which the changelog should start. >+ */ >+ public void setStartTag(final String startTag) { >+ m_startTag = startTag; >+ } >+ >+ /** >+ * Set the tag at which the changelog should end. >+ * >+ * @param endTag The tag at which the changelog should end. >+ */ >+ public void setEndTag(final String endTag) { >+ m_endTag = endTag; >+ } > > >+ public void setRemote(final boolean remote) { >+ m_remote = remote; >+ } >+ > /** > * Set the number of days worth of log entries to process. > * >@@ -201,23 +231,40 @@ > userList.put(user.getUserID(), user.getDisplayname()); > } > >- >- setCommand("log"); >- >- if (getTag() != null) { >- CvsVersion myCvsVersion = new CvsVersion(); >- myCvsVersion.setProject(getProject()); >- myCvsVersion.setTaskName("cvsversion"); >- myCvsVersion.setCvsRoot(getCvsRoot()); >- myCvsVersion.setCvsRsh(getCvsRsh()); >- myCvsVersion.setPassfile(getPassFile()); >- myCvsVersion.setDest(m_dir); >- myCvsVersion.execute(); >- if (myCvsVersion.supportsCvsLogWithSOption()) { >- addCommandArgument("-S"); >- } >- } >- if (null != m_start) { >+ if (m_remote) { >+ // supply 'rlog' as argument instead of command >+ setCommand(""); >+ addCommandArgument("rlog"); >+ // Do not print name/header if no revisions selected. This is quicker: less output to parse. >+ addCommandArgument("-S"); >+ // Do not list tags. This is quicker: less output to parse. >+ addCommandArgument("-N"); >+ } >+ else { >+ setCommand("log"); >+ >+ if (getTag() != null) { >+ CvsVersion myCvsVersion = new CvsVersion(); >+ myCvsVersion.setProject(getProject()); >+ myCvsVersion.setTaskName("cvsversion"); >+ myCvsVersion.setCvsRoot(getCvsRoot()); >+ myCvsVersion.setCvsRsh(getCvsRsh()); >+ myCvsVersion.setPassfile(getPassFile()); >+ myCvsVersion.setDest(m_dir); >+ myCvsVersion.execute(); >+ if (myCvsVersion.supportsCvsLogWithSOption()) { >+ addCommandArgument("-S"); >+ } >+ } >+ } >+ >+ if (null != m_startTag || null != m_endTag) { >+ String tempStartTag = (m_startTag == null ? "" : m_startTag); >+ String tempEndTag = (m_endTag == null ? "" : m_endTag); >+ >+ addCommandArgument("-r" + tempStartTag + "::" + tempEndTag); >+ } >+ else if (null != m_start) { > final SimpleDateFormat outputDate = > new SimpleDateFormat("yyyy-MM-dd"); > >@@ -245,7 +292,15 @@ > } > } > >- final ChangeLogParser parser = new ChangeLogParser(); >+ ChangeLogParser parser = null; >+ >+ if (m_remote) { >+ parser = new ChangeLogParser(m_remote, getPackage()); >+ } >+ else { >+ parser = new ChangeLogParser(); >+ } >+ > final RedirectingStreamHandler handler = > new RedirectingStreamHandler(parser); > >@@ -299,6 +354,16 @@ > > throw new BuildException(message); > } >+ if ((null != m_startTag || null != m_endTag) && (null != m_start || null != m_stop)) { >+ final String message = "Specify either a tag or date range, not both"; >+ >+ throw new BuildException(message); >+ } >+ if ((null != m_startTag || null != m_endTag) && null == getPackage()) { >+ final String message = "Package must be specified when selecting a tag range"; >+ >+ throw new BuildException(message); >+ } > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 27419
: 10653 |
10654