org.hackystat.sensor.ant.svn
Class CommitRecordEntry

java.lang.Object
  extended by org.hackystat.sensor.ant.svn.CommitRecordEntry

public class CommitRecordEntry
extends java.lang.Object

A record tracing the change of one file or one directory in an SVN commit. Note that the path may indication either a directory or a file. During a commit a path name can change, such as in the case of renaming.

If an item is newly created in the commit, then fromPath is null. If an item is deleted, then toPath is null.

Version:
$Id$
Author:
(Cedric) Qin ZHANG

Constructor Summary
CommitRecordEntry(org.tmatesoft.svn.core.io.SVNRepository svnRepository, java.lang.String fromPath, long fromRevision, java.lang.String toPath, long toRevision)
          Create this instance.
 
Method Summary
 java.lang.String getFromPath()
          Gets the from path.
 long getFromRevision()
          Gets the from revision.
 int getLinesAdded()
          Gets the number of lines added.
 int getLinesDeleted()
          Gets the number of lines deleted.
 java.lang.String getToPath()
          Gets the to path.
 long getToRevision()
          Gets the to revision.
 int getTotalLines()
          Gets the total number of lines for the toRevision.
 boolean isFile()
          Checks whether this entry represents a file or not.
 boolean isTextFile()
          Checks whether this entry represents a text file.
 java.lang.String toString()
          Gets a string representation of this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommitRecordEntry

CommitRecordEntry(org.tmatesoft.svn.core.io.SVNRepository svnRepository,
                  java.lang.String fromPath,
                  long fromRevision,
                  java.lang.String toPath,
                  long toRevision)
            throws java.lang.Exception
Create this instance. One of fromPath and toPath can be null, but not both.

Parameters:
svnRepository - SVN repository.
fromPath - The from path.
fromRevision - The from revision.
toPath - The to path.
toRevision - The to revision.
Throws:
java.lang.Exception - If both fromPath and toPath are null.
Method Detail

getFromPath

public java.lang.String getFromPath()
Gets the from path.

Returns:
The from path.

getToPath

public java.lang.String getToPath()
Gets the to path.

Returns:
The to path.

getFromRevision

public long getFromRevision()
Gets the from revision.

Returns:
The from revision.

isFile

public boolean isFile()
               throws java.lang.Exception
Checks whether this entry represents a file or not. Note that a false return value does not necessary mean this entry represents a directory.

Returns:
True if this commit entry represents a file.
Throws:
java.lang.Exception - If there is any error.

isTextFile

public boolean isTextFile()
                   throws java.lang.Exception
Checks whether this entry represents a text file.

Returns:
True if this commit entry represents a text file. False if either this commit entry represents a binary file, or it's not a file at all.
Throws:
java.lang.Exception - If there is any error.

getToRevision

public long getToRevision()
Gets the to revision.

Returns:
The to revision.

getLinesAdded

public int getLinesAdded()
                  throws java.lang.Exception
Gets the number of lines added.

Returns:
The number of lines added.
Throws:
java.lang.Exception - If this entry does not represent a text file, or if there is any other error.

getLinesDeleted

public int getLinesDeleted()
                    throws java.lang.Exception
Gets the number of lines deleted.

Returns:
The number of lines deleted.
Throws:
java.lang.Exception - If this entry does not represent text a file, or if there is any other error.

getTotalLines

public int getTotalLines()
                  throws java.lang.Exception
Gets the total number of lines for the toRevision.

Returns:
The total number of lines.
Throws:
java.lang.Exception - If this entry does not represent a text file, or if there is any other error.

toString

public java.lang.String toString()
Gets a string representation of this instance.

Overrides:
toString in class java.lang.Object
Returns:
The string representation.