Class Builder
- All Implemented Interfaces:
SvnLogBuilder
Helps building the
invalid reference
net.sf.statsvn.model.RepositorycreateRepository() method.
The class also takes care of the creation of Author and Directory objects and makes sure that there's only one of these for each author name and path. It also provides LOC count services.
- Version:
- $Id: Builder.java 389 2009-05-27 18:17:59Z benoitx $
- Author:
- Richard Cyganiak invalid input: '<'richard@cyganiak.de>, Jason Kealey invalid input: '<'jkealey@shade.ca>, Gunter Mussbacher invalid input: '<'gunterm@site.uottawa.ca>
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(RepositoryFileManager repositoryFileManager, net.sf.statcvs.util.FilePatternMatcher includePattern, net.sf.statcvs.util.FilePatternMatcher excludePattern, Pattern tagsPattern) Creates a new Builder -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToAttic(String filename) Adds a file to the attic.voidbuildFile(String filename, boolean isBinary, boolean isInAttic, Map revBySymnames, Map dateBySymnames) Starts building a new file.voidbuildModule(String moduleName) Starts building the module.voidbuildRevision(RevisionData data) Adds a revision to the current file.voidclean()net.sf.statcvs.model.RepositoryReturns a Repository object of all files.Returns the Set of filenames that are "in the attic".net.sf.statcvs.model.Authorreturns the Author of the given name or creates it if it does not yet exist.net.sf.statcvs.model.DirectorygetDirectory(String filename) Returns the Directory of the given filename or creates it if it does not yet exist.New in StatSVN: We need to have access to FileBuilders after they have been created to populate them with version numbers later on.intgetRevision(String filename) net.sf.statcvs.model.SymbolicNamegetSymbolicName(String name, Date date) Returns theSymbolicNamewith the given name or creates it if it does not yet exist.booleanmatchesPatterns(String filename) Matches a filename against the include and exclude patterns.booleanmatchesTagPatterns(String tag) Matches a tag against the tag patterns.voidupdateRevision(String filename, String revisionNumber, int linesAdded, int linesRemoved) New in StatSVN: Updates a particular revision for a file with new line count information.
-
Constructor Details
-
Builder
public Builder(RepositoryFileManager repositoryFileManager, net.sf.statcvs.util.FilePatternMatcher includePattern, net.sf.statcvs.util.FilePatternMatcher excludePattern, Pattern tagsPattern) Creates a new Builder- Parameters:
repositoryFileManager- theRepositoryFileManagerthat can be used to retrieve LOC counts for the files that this builder will createincludePattern- a list of Ant-style wildcard patterns, seperated by : or ;excludePattern- a list of Ant-style wildcard patterns, seperated by : or ;
-
-
Method Details
-
clean
public void clean() -
addToAttic
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 hack to handle post-processing of implicit deletions at the same time as the implicit additions that can be found in Subversion.- Specified by:
addToAtticin interfaceSvnLogBuilder- Parameters:
filename- the filename to add to the attic.
-
buildFile
public void buildFile(String filename, boolean isBinary, boolean isInAttic, Map revBySymnames, Map dateBySymnames) Starts building a new file. The files are not expected to be created in any particular order. Subsequent calls to (@link #buildRevision(RevisionData)) will add revisions to this file.
New in StatSVN: If the method has already been invoked with the same filename, the original file will be re-loaded and the other arguments are ignored.
- Specified by:
buildFilein interfaceSvnLogBuilder- Parameters:
filename- the file's name with path, for example "path/file.txt"isBinary- true if it's a binary fileisInAttic- true if the file is dead on the main branchrevBySymnames- maps revision (string) by symbolic name (string)dateBySymnames- maps date (date) by symbolic name (string)
-
buildModule
Starts building the module.- Specified by:
buildModulein interfaceSvnLogBuilder- Parameters:
moduleName- name of the module
-
buildRevision
Adds a revision to the current file. The revisions must be added in SVN logfile order, that is starting with the most recent one.- Specified by:
buildRevisionin interfaceSvnLogBuilder- Parameters:
data- the revision
-
createRepository
public net.sf.statcvs.model.Repository createRepository()Returns a Repository object of all files.- Returns:
- Repository a Repository object
-
getAtticFileNames
Returns the Set of filenames that are "in the attic".- Returns:
- a Set of Strings
-
getAuthor
returns the Author of the given name or creates it if it does not yet exist. Author names are handled as case-insensitive.- Parameters:
name- the author's name- Returns:
- a corresponding Author object
-
getDirectory
Returns the Directory of the given filename or creates it if it does not yet exist.- Parameters:
filename- the name and path of a file, for example "src/Main.java"- Returns:
- a corresponding Directory object
-
getFileBuilders
New in StatSVN: We need to have access to FileBuilders after they have been created to populate them with version numbers later on.- Specified by:
getFileBuildersin interfaceSvnLogBuilder- Returns:
- this builder's contained (@link FileBuilder)s.
-
getLOC
- Throws:
net.sf.statcvs.input.NoLineCountException- See Also:
-
getProjectName
-
getRevision
- Throws:
IOException- See Also:
-
getSymbolicName
-
matchesPatterns
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.- Specified by:
matchesPatternsin interfaceSvnLogBuilder- 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
Matches a tag against the tag patterns.- Specified by:
matchesTagPatternsin interfaceSvnLogBuilder- Parameters:
tag- a tag- Returns:
- true if the tag matches the tag pattern.
-
updateRevision
public void updateRevision(String filename, 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.- Specified by:
updateRevisionin interfaceSvnLogBuilder- Parameters:
filename- the file to be updatedrevisionNumber- the revision number to be updatedlinesAdded- the lines that were addedlinesRemoved- the lines that were removed
-