net.refactoror.ant
Class DiffTree
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
net.refactoror.ant.DiffTree
- public final class DiffTree
- extends org.apache.tools.ant.Task
Compare two revisions of a directory structure to determine which
elements (files and directories) have been added, deleted, and changed.
Parameters
Attribute |
Description |
Required |
oldDir |
The directory structure to serve as the basis for the comparison.
|
Yes, unless is provided
|
newDir |
An mutated version of the same directory. |
Yes, unless is provided
|
prefix |
Specifies the "family" of properties & filesets that
will capture the element-by-element differences:
- pfxall.unchanged (flag)
- pfxfiles.adds
- pfxfiles.deletes
- pfxfiles.changed
- pfxfiles.unchanged
- pfxdirs.adds
- pfxdirs.deletes
- pfxdirs.changed
- pfxdirs.unchanged
Note that there will not be an intevening dot between the prefix
and the main name parts unless provide one,
(eg, propertyprefix="mystuff." )
|
No |
dump |
Dump the contents of each of the created FileSet definitions
to the console.
|
No |
differentiateMovedFile |
Discover via checksums which deleted/added file pairs
are effectively a elements that has been renamed/moved.
|
No |
listUnchanged |
Generate pfxdirs.unchanged and pfxfiles.unchanged as well.
|
No |
assert |
Tigger a BuildException if the specified
condition is not true. Valid values:
|
No |
The value of the all.unchanged
property will be true or false.
The filesets list zero or more elements:
- The "added" & "changed" sets reference newDir.
- The "deleted" & "unchanged" sets reference oldDir.
- The "moved" foobar references oldDir ... blah blah blah, TBD...
These filesets/dirsets are designed to drive the versioning changes that
will be required to bring the old directory structure up to date
with respect to the new directory structure.
Each element appears in exactly one list. [what about DC/DD?]
Elements are ordered from the top of the directory tree downward,
(with the exception of the dirs.deletes, which are reversed
to facilitate bottom-up directory processing.)
Moved or renamed elements are represented as a delete and an add.
If differentiateMovedFiles
is set to true,
(and propertyPrefix
is set),
then pfxfiles.moved
will hold the list
of "moved" files, and those elements will not appear in deleted/added.
"Moved" is inferred when exactly two files with differing names
and/or parent directories have the same checksum.
Example:
<DiffTree description="prepare import of acme release"
oldDir="projects/zippie/src"
newDir="vendor/acme/src"
propertyprefix="rls."
delimiter=" "
assert="identical"
/>
- Author:
- Chris Noé,
http://refactoror.net
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiffTree
public DiffTree()
setOldDir
public void setOldDir(java.io.File oldDir)
setNewDir
public void setNewDir(java.io.File newDir)
setPrefix
public void setPrefix(java.lang.String prefix)
setDifferentiateMovedFiles
public void setDifferentiateMovedFiles(boolean differentiateMovedFiles)
throws javax.naming.OperationNotSupportedException
- Throws:
javax.naming.OperationNotSupportedException
setListUnchanged
public void setListUnchanged(boolean listUnchanged)
setAssert
public void setAssert(java.lang.String assertion)
setDump
public void setDump(boolean dumpFlag)
addOldFileSet
public void addOldFileSet(OldFileSet oldFileset)
addNewFileSet
public void addNewFileSet(NewFileSet newFileset)
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Throws:
org.apache.tools.ant.BuildException
processResults
protected void processResults(net.refactoror.ant.DiffTree.DiffResults dirDelta,
net.refactoror.ant.DiffTree.DiffResults fileDelta)
throws org.apache.tools.ant.BuildException
- If you extend this Task, override this method in order to produce
the results in different ways, (eg, generate an XML file).
(The default behavior is to create a family of FileSet definitions.)
- Throws:
org.apache.tools.ant.BuildException
dumpPath
protected void dumpPath(java.lang.String indicator,
org.apache.tools.ant.types.DataType thePath,
java.lang.String filesetId)