Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.statsvn.util
Class SvnDiffUtils

    java.lang.Object
      net.sf.statsvn.util.SvnDiffUtils

All Implemented Interfaces:
  ISvnDiffProcessor

Direct Known Subclasses:
  SvnKitDiff

    public class SvnDiffUtils

extends Object
implements ISvnDiffProcessor

Utilities class that manages calls to svn diff.

Version:
  $Id: SvnDiffUtils.java 394 2009-08-10 20:08:46Z jkealey $
Author:
  Jason Kealey , Gunter Mussbacher

Field Summary
`protected static String` | `BINARY_TYPE`
`protected static String` | `INDEX_MARKER`
`protected ISvnProcessor` | `processor`
`protected static String` | `PROPERTY_CHANGE`
`protected static String` | `PROPERTY_NAME`
`protected static int` | `PROPERTY_NAME_LINE`
`static int` | `RESULT_SIZE`

Constructor Summary
`SvnDiffUtils(ISvnProcessor processor)` Invokes diffs using the svn diff command line.

Method Summary
`protected void` | `appendResults(Vector answer, String currFile, StringBuffer sb)` Append results to answer vector.
`protected ProcessUtils` | `callSvnDiff(String newRevNr)` Calls svn diff on all files for given revision and revision-1.
`protected ProcessUtils` | `callSvnDiff(String oldRevNr, String newRevNr, String filename)` Calls svn diff for the filename and revisions given.
`Vector` | `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 ISvnProcessor` | `getProcessor()`
`protected boolean` | `isBinaryErrorMessage(String msg)` Returns 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 void` | `parseMultipleDiffStream(Vector answer, InputStream diffStream)`
`protected int[]` | `parseSingleDiffStream(InputStream diffStream)`
`protected void` | `verifyOutput(ProcessUtils pUtils)` Verifies the process error stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RESULT_SIZE

    public static final int RESULT_SIZE

See Also:
  Constant Field Values

### PROPERTY_NAME_LINE

    protected static final int PROPERTY_NAME_LINE

See Also:
  Constant Field Values

### PROPERTY_CHANGE

    protected static final String PROPERTY_CHANGE

See Also:
  Constant Field Values

### PROPERTY_NAME

    protected static final String PROPERTY_NAME

See Also:
  Constant Field Values

### BINARY_TYPE

    protected static final String BINARY_TYPE

See Also:
  Constant Field Values

### INDEX_MARKER

    protected static final String INDEX_MARKER

See Also:
  Constant Field Values

### processor

    protected ISvnProcessor processor

Constructor Detail

### SvnDiffUtils

    public SvnDiffUtils(ISvnProcessor processor)

  Invokes diffs using the svn diff command line.

Method Detail

### getProcessor

    protected ISvnProcessor 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 number
    `newRevNr` - new revision number
    `filename` - 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

    protected ProcessUtils callSvnDiff(String newRevNr)
                                throws IOException

  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: `ISvnDiffProcessor`
  Returns line count differences between two revisions of a file.

  Specified by:
    `getLineDiff` in interface `ISvnDiffProcessor`
  Parameters:
    `oldRevNr` - old revision number
    `newRevNr` - new revision number
    `filename` - the filename
  Returns:
    A int[2] array of [lines added, lines removed] is returned.
  Throws:
    `IOException` - problem parsing the stream
    `BinaryDiffException` - if the error message is due to trying to diff binary files.

### parseSingleDiffStream

    protected int[] parseSingleDiffStream(InputStream diffStream)
                                   throws IOException,
                                          BinaryDiffException

  Throws:
    `IOException`
    `BinaryDiffException`

### verifyOutput

    protected void verifyOutput(ProcessUtils pUtils)
                         throws IOException,
                                BinaryDiffException

  Verifies the process error stream.

  Parameters:
    `pUtils` - the process call
  Throws:
    `IOException` - problem parsing the stream
    `BinaryDiffException` - if the error message is due to trying to diff binary files.

### getLineDiff

    public Vector getLineDiff(String newRevNr)
                       throws IOException,
                              BinaryDiffException

  Description copied from interface: `ISvnDiffProcessor`
  Returns line count differences for all files in a particular revision.

  Specified by:
    `getLineDiff` in interface `ISvnDiffProcessor`
  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 stream
    `BinaryDiffException` - if the error message is due to trying to diff binary files.

### parseMultipleDiffStream

    protected void parseMultipleDiffStream(Vector answer,
                                           InputStream diffStream)
                                    throws IOException

  Throws:
    `IOException`

### appendResults

    protected void appendResults(Vector answer,
                                 String currFile,
                                 StringBuffer sb)
                          throws IOException

  Append results to answer vector.

  Parameters:
    `answer` - the current answers
    `currFile` - the current file being added.
    `sb` - the diff for this individual file.
  Throws:
    `IOException` - problem parsing the stream
    `BinaryDiffException` - if the error message is due to trying to diff binary files.

### isBinaryErrorMessage

    protected boolean isBinaryErrorMessage(String msg)

  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 stream
    `BinaryDiffException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD