Browse Source

Add support for nested filesets that allow selection of which files ou want to perform cvs log on

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272103 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
1bec7214b9
1 changed files with 36 additions and 0 deletions
  1. +36
    -0
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java

+ 36
- 0
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java View File

@@ -68,8 +68,10 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;

/**
* Change log task.
@@ -126,6 +128,13 @@ public class ChangeLogTask
*/
private Date m_stop;

/**
* Filesets containting list of files against which the cvs log will be
* performed. If empty then all files will in the working directory will
* be checked.
*/
private final Vector m_filesets = new Vector();

/**
* Set the base dir for cvs.
*/
@@ -189,6 +198,16 @@ public class ChangeLogTask
setStart( new Date( time ) );
}

/**
* Adds a set of files about which cvs logs will be generated.
*
* @param fileSet a set of files about which cvs logs will be generated.
*/
public void addFileset( final FileSet fileSet )
{
m_filesets.addElement( fileSet );
}

/**
* Execute task
*/
@@ -221,6 +240,23 @@ public class ChangeLogTask
command.createArgument().setValue( dateRange );
}


// Check if list of files to check has been specified
if( !m_filesets.isEmpty() )
{
final Enumeration e = m_filesets.elements();
while( e.hasMoreElements() )
{
final FileSet fileSet = (FileSet)e.nextElement();
final DirectoryScanner scanner = fileSet.getDirectoryScanner( project );
final String[] files = scanner.getIncludedFiles();
for( int i = 0; i < files.length; i++ )
{
command.createArgument().setValue( files[ i ] );
}
}
}

final ChangeLogParser parser = new ChangeLogParser( userList );
final RedirectingStreamHandler handler =
new RedirectingStreamHandler( parser );


Loading…
Cancel
Save