Class SvnLogfileParser
java.lang.Object
net.sf.statsvn.input.SvnLogfileParser
Parses a Subversion logfile and does post-parse processing. A
Builder
must be specified which does the construction work.- Version:
- $Id: SvnLogfileParser.java 368 2008-06-25 21:23:46Z benoitx $
- Author:
- Jason Kealey invalid input: '<'jkealey@shade.ca>, Gunter Mussbacher invalid input: '<'gunterm@site.uottawa.ca>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Constructor Summary
ConstructorsConstructorDescriptionSvnLogfileParser(RepositoryFileManager repositoryFileManager, InputStream logFile, SvnLogBuilder builder) Default Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleLineCounts(SAXParserFactory factory) Because the log file does not contain the lines added or removed in a commit, and because the logfile contains implicit actions (@link #verifyImplicitActions()), we must query the repository for line differences.voidparse()Parses the logfile.protected SAXParserFactoryParses the svn log file.protected voidWe have created FileBuilders for directories because we needed the information to be able to find implicit actions.protected voidThe svn log can contain deletions of directories which imply that all of its contents have been deleted.
-
Constructor Details
-
SvnLogfileParser
public SvnLogfileParser(RepositoryFileManager repositoryFileManager, InputStream logFile, SvnLogBuilder builder) Default Constructor- Parameters:
repositoryFileManager- the repository file managerlogFile- a Reader containing the SVN logfilebuilder- the builder that will process the log information
-
-
Method Details
-
handleLineCounts
Because the log file does not contain the lines added or removed in a commit, and because the logfile contains implicit actions (@link #verifyImplicitActions()), we must query the repository for line differences. This method uses the (@link LineCountsBuilder) to load the persisted information and (@link SvnDiffUtils) to find new information.- Parameters:
factory- the factory used to create SAX parsers.- Throws:
IOException
-
parse
Parses the logfile. After parse() has finished, the result of the parsing process can be obtained from the builder.- Throws:
net.sf.statcvs.input.LogSyntaxException- if syntax errors in logIOException- if errors while reading from the log Reader
-
verifyImplicitActions
protected void verifyImplicitActions()The svn log can contain deletions of directories which imply that all of its contents have been deleted. Furthermore, the svn log can contain entries which are copies from other directories (additions or replacements; I haven't seen modifications with this property, but am not 100% sure) meaning that all files from the other directory are copied here. We currently do not go back through copies, so we must infer what files could have been added during those copies. -
removeDirectories
protected void removeDirectories()We have created FileBuilders for directories because we needed the information to be able to find implicit actions. However, we don't want to query directories for their line counts later on. Therefore, we must remove them here. (@link SvnInfoUtils#isDirectory(String)) is used to know what files are directories. Deleted directories are assumed to have been added in (@link #verifyImplicitActions()) -
parseSvnLog
protected SAXParserFactory parseSvnLog() throws IOException, net.sf.statcvs.input.LogSyntaxExceptionParses the svn log file.- Returns:
- the SaxParserFactory, so that it can be reused.
- Throws:
IOException- errors while reading file.net.sf.statcvs.input.LogSyntaxException- invalid log syntax.
-