Package net.sf.statcvs.input
Class Builder
java.lang.Object
net.sf.statcvs.input.Builder
- All Implemented Interfaces:
CvsLogBuilder
Helps building the Repository
from a CVS
log. The Builder is fed by some CVS history data source, for
example a CVS log parser. The Repository can be retrieved
using the createCvsContent()
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,v 1.45 2009/05/27 18:19:14 benoitx Exp $
- Author:
- Richard Cyganiak <richard@cyganiak.de>
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(RepositoryFileManager repositoryFileManager, FilePatternMatcher includePattern, FilePatternMatcher excludePattern, Pattern tagsPattern) Creates a new Builder -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
void
Starts building a new file.void
buildModule
(String moduleName) Starts building the module.void
buildRevision
(RevisionData data) Adds a revision to the current file.void
clean()
Returns a Repository object of all files.Returns the Set of filenames that are "in the attic".returns the Author of the given name or creates it if it does not yet exist.getDirectory
(String filename) Returns the Directory of the given filename or creates it if it does not yet exist.int
getRevision
(String filename) getSymbolicName
(String name) Returns theSymbolicName
with the given name or creates it if it does not yet exist.boolean
Returns true if at least some local files have matching entries in local CVS metada directories.boolean
Returns true if no local copy was found for the majority of files in the log.boolean
Returns true if the local working copy is out of sync with the log.boolean
matchesPatterns
(String filename) Matches a filename against the include and exclude patterns.
-
Constructor Details
-
Builder
public Builder(RepositoryFileManager repositoryFileManager, FilePatternMatcher includePattern, FilePatternMatcher excludePattern, Pattern tagsPattern) Creates a new Builder- Parameters:
repositoryFileManager
- theRepositoryFileManager
that 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 ;tagsPattern
- A regular expression; matching symbolic names are recorded
-
-
Method Details
-
clean
public void clean() -
buildModule
Starts building the module.- Specified by:
buildModule
in interfaceCvsLogBuilder
- Parameters:
moduleName
- name of the module
-
buildFile
Starts building a new file. The files are not expected to be created in any particular order.- Specified by:
buildFile
in interfaceCvsLogBuilder
- 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)
-
buildRevision
Adds a revision to the current file. The revisions must be added in CVS logfile order, that is starting with the most recent one.- Specified by:
buildRevision
in interfaceCvsLogBuilder
- Parameters:
data
- the revision
-
createCvsContent
Returns a Repository object of all files.- Returns:
- Repository a Repository object
-
getProjectName
-
getAtticFileNames
Returns the Set of filenames that are "in the attic".- Returns:
- a Set of Strings
-
allRejectedByExcludePattern
public boolean allRejectedByExcludePattern()- Returns:
- true if there was an exclude pattern, and it rejected all files
-
allRejectedByIncludePattern
public boolean allRejectedByIncludePattern()- Returns:
- true if there was an include pattern, and it rejected all files
-
isLogAndLocalFilesOutOfSync
public boolean isLogAndLocalFilesOutOfSync()Returns true if the local working copy is out of sync with the log. The current implementation spots if local files have been deleted and not yet committed, or if the log file was generated before the latest commit. -
isLocalFilesNotFound
public boolean isLocalFilesNotFound()Returns true if no local copy was found for the majority of files in the log. This is a strong indication that the log is not for the specified local working copy. -
hasLocalCVSMetadata
public boolean hasLocalCVSMetadata()Returns true if at least some local files have matching entries in local CVS metada directories. If this is not the case, then the local copy is probably just an export, not a checkout, and we can't check if the log and working copy are in sync. -
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
-
getSymbolicName
Returns theSymbolicName
with the given name or creates it if it does not yet exist.- Parameters:
name
- the symbolic name's name- Returns:
- the corresponding symbolic name object
-
getLOC
- Throws:
NoLineCountException
-
getRevision
- Throws:
IOException
- See Also:
-
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.- 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.
-