net.sf.statcvs.input
Class Builder
- 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.
$Id: Builder.java,v 1.40 2008/04/02 11:22:14 benoitx Exp $
Builder
public Builder(RepositoryFileManager repositoryFileManager,
FilePatternMatcher includePattern,
FilePatternMatcher excludePattern,
Pattern tagsPattern)
Creates a new Builder
repositoryFileManager
- the RepositoryFileManager
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
allRejectedByExcludePattern
public boolean allRejectedByExcludePattern()
- true if there was an exclude pattern, and it rejected all files
allRejectedByIncludePattern
public boolean allRejectedByIncludePattern()
- true if there was an include pattern, and it rejected all files
buildFile
public void buildFile(String filename,
boolean isBinary,
boolean isInAttic,
Map revBySymnames)
Starts building a new file. The files are not expected to be created
in any particular order.
- buildFile in interface CvsLogBuilder
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)
buildModule
public void buildModule(String moduleName)
Starts building the module.
- buildModule in interface CvsLogBuilder
moduleName
- name of the module
buildRevision
public void buildRevision(RevisionData data)
Adds a revision to the current file. The revisions must be added in
CVS logfile order, that is starting with the most recent one.
- buildRevision in interface CvsLogBuilder
createCvsContent
public Repository createCvsContent()
Returns a Repository object of all files.
- Repository a Repository object
getAtticFileNames
public Set getAtticFileNames()
Returns the Set of filenames that are "in the attic".
getAuthor
public Author getAuthor(String name)
returns the Author of the given name or creates it
if it does not yet exist. Author names are handled as case-insensitive.
- a corresponding Author object
getDirectory
public Directory getDirectory(String filename)
Returns the Directory of the given filename or creates it
if it does not yet exist.
filename
- the name and path of a file, for example "src/Main.java"
- a corresponding Directory object
getProjectName
public String getProjectName()
getRevision
public String getRevision(String filename)
throws IOException
getSymbolicName
public SymbolicName getSymbolicName(String name)
Returns the
SymbolicName
with the given name or creates it
if it does not yet exist.
name
- the symbolic name's name
- the corresponding symbolic name object
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.
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.
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.
matchesPatterns
public boolean matchesPatterns(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.
- 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.