Class SvnDiffUtils
java.lang.Object
net.sf.statsvn.util.SvnDiffUtils
- All Implemented Interfaces:
ISvnDiffProcessor
- Direct Known Subclasses:
SvnKitDiff
Utilities class that manages calls to svn diff.
- Version:
- $Id: SvnDiffUtils.java 394 2009-08-10 20:08:46Z jkealey $
- Author:
- Jason Kealey invalid input: '<'jkealey@shade.ca>, Gunter Mussbacher invalid input: '<'gunterm@site.uottawa.ca>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected ISvnProcessorprotected static final Stringprotected static final Stringprotected static final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionSvnDiffUtils(ISvnProcessor processor) Invokes diffs using the svn diff command line. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendResults(Vector answer, String currFile, StringBuffer sb) Append results to answer vector.protected ProcessUtilscallSvnDiff(String newRevNr) Calls svn diff on all files for given revision and revision-1.protected ProcessUtilscallSvnDiff(String oldRevNr, String newRevNr, String filename) Calls svn diff for the filename and revisions given.getLineDiff(String newRevNr) Returns line count differences for all files in a particular revision.int[]getLineDiff(String oldRevNr, String newRevNr, String filename) Returns line count differences between two revisions of a file.protected ISvnProcessorprotected booleanReturns true if msg is an error message display that the file is binary.protected int[]parseDiff(net.sf.statcvs.util.LookaheadReader diffReader) Returns line count differences between two revisions of a file.protected voidparseMultipleDiffStream(Vector answer, InputStream diffStream) protected int[]parseSingleDiffStream(InputStream diffStream) protected voidverifyOutput(ProcessUtils pUtils) Verifies the process error stream.
-
Field Details
-
RESULT_SIZE
public static final int RESULT_SIZE- See Also:
-
PROPERTY_NAME_LINE
protected static final int PROPERTY_NAME_LINE- See Also:
-
PROPERTY_CHANGE
- See Also:
-
PROPERTY_NAME
- See Also:
-
BINARY_TYPE
- See Also:
-
INDEX_MARKER
- See Also:
-
processor
-
-
Constructor Details
-
SvnDiffUtils
Invokes diffs using the svn diff command line.
-
-
Method Details
-
getProcessor
-
callSvnDiff
protected ProcessUtils callSvnDiff(String oldRevNr, String newRevNr, String filename) throws IOException Calls svn diff for the filename and revisions given. Will use URL invocation, to ensure that we get diffs even for deleted files.- Parameters:
oldRevNr- old revision numbernewRevNr- new revision numberfilename- filename.- Returns:
- the InputStream related to the call. If the error steam is non-empty, will return the error stream instead of the default input stream.
- Throws:
IOException
-
callSvnDiff
Calls svn diff on all files for given revision and revision-1.- Parameters:
newRevNr- revision number- Returns:
- the InputStream related to the call. If the error steam is non-empty, will return the error stream instead of the default input stream.
- Throws:
IOException
-
getLineDiff
public int[] getLineDiff(String oldRevNr, String newRevNr, String filename) throws IOException, BinaryDiffException Description copied from interface:ISvnDiffProcessorReturns line count differences between two revisions of a file.- Specified by:
getLineDiffin interfaceISvnDiffProcessor- Parameters:
oldRevNr- old revision numbernewRevNr- new revision numberfilename- the filename- Returns:
- A int[2] array of [lines added, lines removed] is returned.
- Throws:
IOException- problem parsing the streamBinaryDiffException- if the error message is due to trying to diff binary files.
-
parseSingleDiffStream
protected int[] parseSingleDiffStream(InputStream diffStream) throws IOException, BinaryDiffException - Throws:
IOExceptionBinaryDiffException
-
verifyOutput
Verifies the process error stream.- Parameters:
pUtils- the process call- Throws:
IOException- problem parsing the streamBinaryDiffException- if the error message is due to trying to diff binary files.
-
getLineDiff
Description copied from interface:ISvnDiffProcessorReturns line count differences for all files in a particular revision.- Specified by:
getLineDiffin interfaceISvnDiffProcessor- Parameters:
newRevNr- new revision number- Returns:
- A vector of object[3] array of [filename, int[2](lines added, lines removed), isBinary] is returned.
- Throws:
IOException- problem parsing the streamBinaryDiffException- if the error message is due to trying to diff binary files.
-
parseMultipleDiffStream
- Throws:
IOException
-
appendResults
Append results to answer vector.- Parameters:
answer- the current answerscurrFile- the current file being added.sb- the diff for this individual file.- Throws:
IOException- problem parsing the streamBinaryDiffException- if the error message is due to trying to diff binary files.
-
isBinaryErrorMessage
Returns true if msg is an error message display that the file is binary.- Parameters:
msg- the error message given by ProcessUtils.getErrorMessage();- Returns:
- true if the file is binary
-
parseDiff
protected int[] parseDiff(net.sf.statcvs.util.LookaheadReader diffReader) throws IOException, BinaryDiffException Returns line count differences between two revisions of a file.- Parameters:
diffReader- the stream reader for svn diff- Returns:
- A int[2] array of [lines added, lines removed] is returned.
- Throws:
IOException- problem parsing the streamBinaryDiffException
-