Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.cvslib

public Class CvsTagDiff

extends AbstractCvsTask
Class Inheritance
Imports
java.io.BufferedReader, .File, .FileReader, .IOException, .OutputStreamWriter, .PrintWriter, .UnsupportedEncodingException, java.nio.charset.StandardCharsets, java.nio.file.Files, java.util.ArrayList, .List, .StringTokenizer, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.taskdefs.AbstractCvsTask, org.apache.tools.ant.util.DOMElementWriter, .DOMUtils, .FileUtils, org.w3c.dom.Document, .Element

Examines the output of cvs rdiff between two tags. It produces an XML output representing the list of changes.
<!-- Root element -->
<!ELEMENT tagdiff (entry+) >
<!-- Start tag of the report -->
<!ATTLIST tagdiff startTag NMTOKEN #IMPLIED >
<!-- End tag of the report -->
<!ATTLIST tagdiff endTag NMTOKEN #IMPLIED >
<!-- Start date of the report -->
<!ATTLIST tagdiff startDate NMTOKEN #IMPLIED >
<!-- End date of the report -->
<!ATTLIST tagdiff endDate NMTOKEN #IMPLIED >

<!-- CVS tag entry -->
<!ELEMENT entry (file) >
<!-- File added, changed or removed -->
<!ELEMENT file (name, revision?, prevrevision?) >
<!-- Name of the file -->
<!ELEMENT name (#PCDATA) >
<!-- Revision number -->
<!ELEMENT revision (#PCDATA) >
<!-- Previous revision number -->
<!ELEMENT prevrevision (#PCDATA) >
Since
Ant 1.5

Field Summary

Modifier and TypeField and Description
private static final DOMElementWriter
DOM_WRITER

stateless helper for writing the XML document

pack-priv static final String
FILE_HAS_CHANGED

Token to identify a modified file in the rdiff log

pack-priv static final String
FILE_IS_NEW

Token to identify a new file in the rdiff log

pack-priv static final String
FILE_STRING

Token to identify the word file in the rdiff log

pack-priv static final int
FILE_STRING_LENGTH

Length of token to identify the word file in the rdiff log

private static final FileUtils
FILE_UTILS

Used to create the temp file for cvs log

pack-priv static final String
FILE_WAS_REMOVED

Token to identify a removed file in the rdiff log

private boolean
ignoreRemoved

Used to skip over removed files

private File
mydestfile

The file in which to write the diff report.

private String
myendDate

The latest date from which diffs are to be included in the report.

private String
myendTag

The latest tag from which diffs are to be included in the report.

private String
mypackage

The cvs package/module to analyse

private String
mystartDate

The earliest date from which diffs are to be included in the report.

private String
mystartTag

The earliest tag from which diffs are to be included in the report.

private String[]
packageNamePrefixes

temporary list of "File:" + package name + "/" for all packages.

private int[]
packageNamePrefixLengths

temporary list of length values for prefixes.

private List<String>
packageNames

temporary list of package names.

pack-priv static final String
REVISION

Token to identify the revision

pack-priv static final String
TO_STRING

Token to identify the word file in the rdiff log

Inherited from org.apache.tools.ant.taskdefs.AbstractCvsTask:
DEFAULT_COMPRESSION_LEVEL

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
private boolean
private boolean
public void
private void
handlePackageNames()

collects package names from the package attribute and nested module elements.

private CvsTagEntry[]

Returns:

the entries in the output
parseRDiff
(File
the File containing the output of the cvs rdiff command
tmpFile
)

Parse the tmpFile and return and array of CvsTagEntry to be written in the output.

private static String

Returns:

null if the line was shorter than expected.
removePackageName
(String line, String[] packagePrefixes, int[] prefixLengths)

removes a "File: module/" prefix if present.

public void
setDestFile(File
the output file for the diff.
f
)

Set the output file for the diff.

public void
setEndDate(String
the end date.
s
)

Set the end date.

public void
setEndTag(String
the end tag.
s
)

Set the end tag.

public void
setIgnoreRemoved(boolean
the ignore removed indicator.
b
)

Set the ignore removed indicator.

public void
setPackage(String
the name of the package to analyse
p
)

Overrides org.apache.tools.ant.taskdefs.AbstractCvsTask.setPackage.

The package/module to analyze.
public void
setStartDate(String
the start date.
s
)

Set the start date.

public void
setStartTag(String
the start tag.
s
)

Set the start tag.

private void
validate()

Validate the parameters specified for task.

private void
writeTagDiff(CvsTagEntry[]
a CvsTagEntry[] value
entries
)

Write the rdiff log.

private void
writeTagEntry(Document
Document used to create elements.
doc
,
PrintWriter
a PrintWriter value
writer
,
CvsTagEntry
a CvsTagEntry value
entry
)

Write a single entry to the given writer.

Inherited from org.apache.tools.ant.taskdefs.AbstractCvsTask:
addCommandArgumentaddCommandArgumentaddConfiguredCommandlineaddConfiguredCommandlineaddModuleconfigureCommandlinegetCommandgetCvsRootgetCvsRshgetDestgetErrorStreamgetExecuteStreamHandlergetModulesgetOutputStreamgetPackagegetPassFilegetPortgetTagremoveCommandlinerunCommandsetAppendsetCommandsetCompressionsetCompressionLevelsetCvsRootsetCvsRshsetDatesetDestsetErrorsetErrorStreamsetExecuteStreamHandlersetFailOnErrorsetNoexecsetOutputsetOutputStreamsetPassfilesetPortsetQuietsetReallyquietsetTag

Field Detail

DOM_WRITERback to summary
private static final DOMElementWriter DOM_WRITER

stateless helper for writing the XML document

FILE_HAS_CHANGEDback to summary
pack-priv static final String FILE_HAS_CHANGED

Token to identify a modified file in the rdiff log

FILE_IS_NEWback to summary
pack-priv static final String FILE_IS_NEW

Token to identify a new file in the rdiff log

FILE_STRINGback to summary
pack-priv static final String FILE_STRING

Token to identify the word file in the rdiff log

FILE_STRING_LENGTHback to summary
pack-priv static final int FILE_STRING_LENGTH

Length of token to identify the word file in the rdiff log

FILE_UTILSback to summary
private static final FileUtils FILE_UTILS

Used to create the temp file for cvs log

FILE_WAS_REMOVEDback to summary
pack-priv static final String FILE_WAS_REMOVED

Token to identify a removed file in the rdiff log

ignoreRemovedback to summary
private boolean ignoreRemoved

Used to skip over removed files

mydestfileback to summary
private File mydestfile

The file in which to write the diff report.

myendDateback to summary
private String myendDate

The latest date from which diffs are to be included in the report.

myendTagback to summary
private String myendTag

The latest tag from which diffs are to be included in the report.

mypackageback to summary
private String mypackage

The cvs package/module to analyse

mystartDateback to summary
private String mystartDate

The earliest date from which diffs are to be included in the report.

mystartTagback to summary
private String mystartTag

The earliest tag from which diffs are to be included in the report.

packageNamePrefixesback to summary
private String[] packageNamePrefixes

temporary list of "File:" + package name + "/" for all packages.

packageNamePrefixLengthsback to summary
private int[] packageNamePrefixLengths

temporary list of length values for prefixes.

packageNamesback to summary
private List<String> packageNames

temporary list of package names.

REVISIONback to summary
pack-priv static final String REVISION

Token to identify the revision

TO_STRINGback to summary
pack-priv static final String TO_STRING

Token to identify the word file in the rdiff log

Constructor Detail

CvsTagDiffback to summary
public CvsTagDiff()

Method Detail

doFileHasChangedback to summary
private boolean doFileHasChanged(List<CvsTagEntry> entries, String line)
doFileIsNewback to summary
private boolean doFileIsNew(List<CvsTagEntry> entries, String line)
doFileWasRemovedback to summary
private boolean doFileWasRemoved(List<CvsTagEntry> entries, String line)
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.taskdefs.AbstractCvsTask.execute.

Execute task.

Annotations
@Override
Exceptions
BuildException:
if an error occurs
handlePackageNamesback to summary
private void handlePackageNames()

collects package names from the package attribute and nested module elements.

parseRDiffback to summary
private CvsTagEntry[] parseRDiff(File tmpFile) throws BuildException

Parse the tmpFile and return and array of CvsTagEntry to be written in the output.

Parameters
tmpFile:File

the File containing the output of the cvs rdiff command

Returns:CvsTagEntry[]

the entries in the output

Exceptions
BuildException:
if an error occurs
removePackageNameback to summary
private static String removePackageName(String line, String[] packagePrefixes, int[] prefixLengths)

removes a "File: module/" prefix if present.

Returns:String

null if the line was shorter than expected.

setDestFileback to summary
public void setDestFile(File f)

Set the output file for the diff.

Parameters
f:File

the output file for the diff.

setEndDateback to summary
public void setEndDate(String s)

Set the end date.

Parameters
s:String

the end date.

setEndTagback to summary
public void setEndTag(String s)

Set the end tag.

Parameters
s:String

the end tag.

setIgnoreRemovedback to summary
public void setIgnoreRemoved(boolean b)

Set the ignore removed indicator.

Parameters
b:boolean

the ignore removed indicator.

Since
Ant 1.8.0
setPackageback to summary
public void setPackage(String p)

Overrides org.apache.tools.ant.taskdefs.AbstractCvsTask.setPackage.

The package/module to analyze.

Parameters
p:String

the name of the package to analyse

Annotations
@Override
setStartDateback to summary
public void setStartDate(String s)

Set the start date.

Parameters
s:String

the start date.

setStartTagback to summary
public void setStartTag(String s)

Set the start tag.

Parameters
s:String

the start tag.

validateback to summary
private void validate() throws BuildException

Validate the parameters specified for task.

Exceptions
BuildException:
if a parameter is not correctly set
writeTagDiffback to summary
private void writeTagDiff(CvsTagEntry[] entries) throws BuildException

Write the rdiff log.

Parameters
entries:CvsTagEntry[]

a CvsTagEntry[] value

Exceptions
BuildException:
if an error occurs
writeTagEntryback to summary
private void writeTagEntry(Document doc, PrintWriter writer, CvsTagEntry entry) throws IOException

Write a single entry to the given writer.

Parameters
doc:Document

Document used to create elements.

writer:PrintWriter

a PrintWriter value

entry:CvsTagEntry

a CvsTagEntry value