public class SVNAnnotationGenerator extends java.lang.Object implements ISVNFileRevisionHandler
Since SVNAnnotationGenerator implements ISVNFileRevisionHandler,
it is merely passed to a getFileRevisions()
method of SVNRepository. After that you handle the resultant annotated
file line-by-line providing an ISVNAnnotateHandler implementation to the reportAnnotations()
method:
import org.tmatesoft.svn.core.SVNAnnotationGenerator; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.wc.SVNAnnotateHandler; ... File tmpFile; SVNRepository repos; ISVNAnnotateHandler annotateHandler; ISVNEventHandler cancelHandler; long startRev = 0; long endRev = 150; ... SVNAnnotationGenerator generator = new SVNAnnotationGenerator(path, tmpFile, cancelHandler); try { repos.getFileRevisions("", startRev, endRev, generator); generator.reportAnnotations(annotateHandler, null); } finally { generator.dispose(); } ...
Modifier and Type | Class and Description |
---|---|
private static class |
SVNAnnotationGenerator.BlameChunk |
Modifier and Type | Field and Description |
---|---|
private java.util.List |
myBlameChunks |
private ISVNEventHandler |
myCancelBaton |
private java.lang.String |
myCurrentAuthor |
private java.util.Date |
myCurrentDate |
private java.io.File |
myCurrentFile |
private java.lang.String |
myCurrentPath |
private long |
myCurrentRevision |
private SVNDeltaProcessor |
myDeltaProcessor |
private SVNDiffOptions |
myDiffOptions |
private java.lang.String |
myEncoding |
private ISVNAnnotateHandler |
myFileHandler |
private boolean |
myIncludeMergedRevisions |
private boolean |
myIsCurrentResultOfMerge |
private boolean |
myIsForce |
private boolean |
myIsLastRevisionReported |
private boolean |
myIsTmpDirCreated |
private java.util.List |
myMergeBlameChunks |
private java.lang.String |
myPath |
private java.io.File |
myPreviousFile |
private java.io.File |
myPreviousOriginalFile |
private de.regnis.q.sequence.line.simplifier.QSequenceLineSimplifier |
mySimplifier |
private long |
myStartRevision |
private java.io.File |
myTmpDirectory |
Constructor and Description |
---|
SVNAnnotationGenerator(java.lang.String path,
java.io.File tmpDirectory,
long startRevision,
boolean force,
boolean includeMergedRevisions,
SVNDiffOptions diffOptions,
java.lang.String encoding,
ISVNAnnotateHandler handler,
ISVNEventHandler cancelBaton)
Constructs an annotation generator object.
|
SVNAnnotationGenerator(java.lang.String path,
java.io.File tmpDirectory,
long startRevision,
boolean force,
ISVNEventHandler cancelBaton)
Constructs an annotation generator object.
|
SVNAnnotationGenerator(java.lang.String path,
java.io.File tmpDirectory,
long startRevision,
boolean force,
SVNDiffOptions diffOptions,
ISVNEventHandler cancelBaton)
Constructs an annotation generator object.
|
SVNAnnotationGenerator(java.lang.String path,
java.io.File tmpDirectory,
long startRevision,
ISVNEventHandler cancelBaton)
Constructs an annotation generator object.
|
Modifier and Type | Method and Description |
---|---|
private java.util.List |
addFileBlame(java.io.File previousFile,
java.io.File currentFile,
java.util.List chain) |
void |
addFileBlame(java.io.InputStream contents) |
private void |
adjustBlameChunks(java.util.List chain,
int startIndex,
int adjust) |
void |
applyTextDelta(java.lang.String token,
java.lang.String baseChecksum)
Creates a temporary file for delta application.
|
void |
closeRevision(java.lang.String token)
Does nothing.
|
private de.regnis.q.sequence.line.simplifier.QSequenceLineSimplifier |
createSimplifier() |
private void |
deleteBlameChunk(int start,
int length,
java.util.List chain) |
void |
dispose()
Finalizes an annotation operation releasing resources involved
by this generator.
|
private SVNAnnotationGenerator.BlameChunk |
findBlameChunk(java.util.List chain,
int offset,
int[] index) |
private void |
insertBlameChunk(long revision,
java.lang.String author,
java.util.Date date,
java.lang.String path,
int start,
int length,
java.util.List chain) |
boolean |
isLastRevisionReported()
This method is used by
SVNKit internals and is not intended for API users. |
private void |
normalizeBlames(java.util.List chain,
java.util.List mergedChain) |
void |
openRevision(SVNFileRevision fileRevision)
Handles a next revision.
|
void |
reportAnnotations(ISVNAnnotateHandler handler,
java.lang.String inputEncoding)
Dispatches file lines along with author & revision info to the provided
annotation handler.
|
java.io.OutputStream |
textDeltaChunk(java.lang.String token,
SVNDiffWindow diffWindow)
Applies a next text delta chunk.
|
void |
textDeltaEnd(java.lang.String token)
Marks the end of the text delta series.
|
private java.io.File myTmpDirectory
private boolean myIsTmpDirCreated
private java.lang.String myPath
private long myCurrentRevision
private java.lang.String myCurrentAuthor
private java.util.Date myCurrentDate
private boolean myIsCurrentResultOfMerge
private java.lang.String myCurrentPath
private java.io.File myPreviousFile
private java.io.File myPreviousOriginalFile
private java.io.File myCurrentFile
private java.util.List myMergeBlameChunks
private java.util.List myBlameChunks
private SVNDeltaProcessor myDeltaProcessor
private ISVNEventHandler myCancelBaton
private long myStartRevision
private boolean myIsForce
private boolean myIncludeMergedRevisions
private SVNDiffOptions myDiffOptions
private de.regnis.q.sequence.line.simplifier.QSequenceLineSimplifier mySimplifier
private ISVNAnnotateHandler myFileHandler
private java.lang.String myEncoding
private boolean myIsLastRevisionReported
public SVNAnnotationGenerator(java.lang.String path, java.io.File tmpDirectory, long startRevision, ISVNEventHandler cancelBaton)
This constructor is equivalent to
SVNAnnotationGenerator(path, tmpDirectory, startRevision, false, cancelBaton)
.
path
- a file path (relative to a repository location)tmpDirectory
- a revision to stop atstartRevision
- a start revision to begin annotation withcancelBaton
- a baton which is used to check if an operation
is cancelledpublic SVNAnnotationGenerator(java.lang.String path, java.io.File tmpDirectory, long startRevision, boolean force, ISVNEventHandler cancelBaton)
SVNAnnotationGenerator(path, tmpDirectory, startRevision, force, new SVNDiffOptions(), cancelBaton)
.path
- a file path (relative to a repository location)tmpDirectory
- a revision to stop atstartRevision
- a start revision to begin annotation withforce
- forces binary files processingcancelBaton
- a baton which is used to check if an operation
is cancelledpublic SVNAnnotationGenerator(java.lang.String path, java.io.File tmpDirectory, long startRevision, boolean force, SVNDiffOptions diffOptions, ISVNEventHandler cancelBaton)
SVNAnnotationGenerator(path, tmpDirectory, startRevision, force, false, diffOptions, null, null, cancelBaton)
.path
- a file path (relative to a repository location)tmpDirectory
- a revision to stop atstartRevision
- a start revision to begin annotation withforce
- forces binary files processingdiffOptions
- diff optionscancelBaton
- a baton which is used to check if an operation
is cancelledpublic SVNAnnotationGenerator(java.lang.String path, java.io.File tmpDirectory, long startRevision, boolean force, boolean includeMergedRevisions, SVNDiffOptions diffOptions, java.lang.String encoding, ISVNAnnotateHandler handler, ISVNEventHandler cancelBaton)
path
- a file path (relative to a repository location) or URL-encoded URLtmpDirectory
- a revision to stop atstartRevision
- a start revision to begin annotation withforce
- forces binary files processingincludeMergedRevisions
- whether to include merged revisions or notdiffOptions
- diff optionsencoding
- charset name to use to encode annotation resulthandler
- caller's annotation handler implementationcancelBaton
- a baton which is used to check if an operation
is cancelledpublic void openRevision(SVNFileRevision fileRevision) throws SVNException
openRevision
in interface ISVNFileRevisionHandler
fileRevision
- SVNException
- if one of the following occurs:
SVNErrorCode.CLIENT_IS_BINARY_FILE
error code - if the file is binary and no
forcing is specified
SVNFileRevision
public void closeRevision(java.lang.String token) throws SVNException
closeRevision
in interface ISVNFileRevisionHandler
token
- SVNException
public void applyTextDelta(java.lang.String token, java.lang.String baseChecksum) throws SVNException
applyTextDelta
in interface ISVNDeltaConsumer
token
- not used in this methodbaseChecksum
- not used in this methodSVNException
public java.io.OutputStream textDeltaChunk(java.lang.String token, SVNDiffWindow diffWindow) throws SVNException
textDeltaChunk
in interface ISVNDeltaConsumer
token
- not used in this methoddiffWindow
- next diff windowSVNException
public void textDeltaEnd(java.lang.String token) throws SVNException
textDeltaEnd
in interface ISVNDeltaConsumer
token
- not used in this methodSVNException
public void addFileBlame(java.io.InputStream contents) throws SVNException
SVNException
public boolean isLastRevisionReported()
SVNKit
internals and is not intended for API users.public void reportAnnotations(ISVNAnnotateHandler handler, java.lang.String inputEncoding) throws SVNException
If inputEncoding
is null then
"file.encoding" system property is used.
handler
- an annotation handler that processes file lines with
author & revision infoinputEncoding
- a desired character set (encoding) of text linesSVNException
public void dispose()
reportAnnotations()
.private java.util.List addFileBlame(java.io.File previousFile, java.io.File currentFile, java.util.List chain) throws SVNException
SVNException
private void insertBlameChunk(long revision, java.lang.String author, java.util.Date date, java.lang.String path, int start, int length, java.util.List chain)
private void deleteBlameChunk(int start, int length, java.util.List chain)
private void adjustBlameChunks(java.util.List chain, int startIndex, int adjust)
private SVNAnnotationGenerator.BlameChunk findBlameChunk(java.util.List chain, int offset, int[] index)
private void normalizeBlames(java.util.List chain, java.util.List mergedChain) throws SVNException
SVNException
private de.regnis.q.sequence.line.simplifier.QSequenceLineSimplifier createSimplifier()