net.sf.statsvn.input
Interface SvnLogBuilder

All Known Implementing Classes:
Builder

public interface SvnLogBuilder

Interface for defining a Builder that constructs a data structure from a SVM logfile. SvnLogfileParser takes an instance of this interface and will call methods on the interface for every piece of data it encounters in the log.

First, SvnLogBuilder.buildModule(java.lang.String) will be called with the name of the module. Then, SvnLogBuilder.buildFile(java.lang.String, boolean, boolean, java.util.Map, java.util.Map) will be called with the filename and other pieces of information of the first file in the log. Then, for every revision of this file, SvnLogBuilder.buildRevision(net.sf.statsvn.input.RevisionData) is called. The calls to buildFile and buildRevision are repeated for every file in the log.

The files are in no particular order. The revisions of one file are ordered by time, beginning with the most recent.

 

Method Summary
 void addToAttic(java.lang.String filename)
          Adds a file to the attic.
 void buildFile(java.lang.String filename, boolean isBinary, boolean isInAttic, java.util.Map revBySymnames, java.util.Map dateBySymnames)
          Starts building a new file.
 void buildModule(java.lang.String moduleName)
          Starts building a module.
 void buildRevision(RevisionData data)
          Adds a revision to the last file that was built..
 java.util.Map getFileBuilders()
          New in StatSVN: We need to have access to FileBuilders after they have been created to populate them with version numbers later on.
 boolean matchesPatterns(java.lang.String filename)
          Matches a filename against the include and exclude patterns.
 boolean matchesTagPatterns(java.lang.String tag)
          Matches a tag against the tag patterns.
 void updateRevision(java.lang.String filename, java.lang.String revisionNumber, int linesAdded, int linesRemoved)
          New in StatSVN: Updates a particular revision for a file with new line count information.
 

Method Detail

buildModule

void buildModule(java.lang.String moduleName)
Starts building a module.

Parameters:
moduleName - the name of the module

buildFile

void buildFile(java.lang.String filename,
               boolean isBinary,
               boolean isInAttic,
               java.util.Map revBySymnames,
               java.util.Map dateBySymnames)
Starts building a new file. The files are not processed in any particular order.

Parameters:
filename - the file's name with path relative to the module, for example "path/file.txt"
isBinary - true if it's a binary file
isInAttic - true if the file is dead on the main branch
revBySymnames - maps revision (string) by symbolic name (string)
dateBySymnames - maps date (date) by symbolic name (string)

buildRevision

void buildRevision(RevisionData data)
Adds a revision to the last file that was built.. The revisions are added in SVN logfile order, that is starting with the most recent one.

Parameters:
data - the revision

addToAttic

void addToAttic(java.lang.String filename)
Adds a file to the attic. This method should only be called if our first invocation to (@link #buildFile(String, boolean, boolean, Map)) was given an invalid isInAttic field. This is a way to handle post-processing of implicit deletions at the same time as the implicit additions that can be found in Subversion.

Parameters:
filename - the filename to add to the attic.

getFileBuilders

java.util.Map getFileBuilders()
New in StatSVN: We need to have access to FileBuilders after they have been created to populate them with version numbers later on.

Returns:
this builder's contained (@link FileBuilder)s.

updateRevision

void updateRevision(java.lang.String filename,
                    java.lang.String revisionNumber,
                    int linesAdded,
                    int linesRemoved)
New in StatSVN: Updates a particular revision for a file with new line count information. If the file or revision does not exist, action will do nothing. Necessary because line counts are not given in the log file and hence can only be added in a second pass.

Parameters:
filename - the file to be updated
revisionNumber - the revision number to be updated
linesAdded - the lines that were added
linesRemoved - the lines that were removed

matchesPatterns

boolean matchesPatterns(java.lang.String filename)
Matches a filename against the include and exclude patterns. If no include pattern was specified, all files will be included. If no exclude pattern was specified, no files will be excluded.

Parameters:
filename - a filename
Returns:
true if the filename matches one of the include patterns and does not match any of the exclude patterns. If it matches an include and an exclude pattern, false will be returned.

matchesTagPatterns

boolean matchesTagPatterns(java.lang.String tag)
Matches a tag against the tag patterns.

Parameters:
tag - a tag
Returns:
true if the tag matches the tag pattern.