Class RepositoryFileManager
java.lang.Object
net.sf.statsvn.input.RepositoryFileManager
Manages a checked-out repository and provides access to line number counts
for repository files.
New in StatSVN: Also provides a central point of access to abstract out calls
to the server. Many of the methods here simply redirect to the static
util/SvnXXXUtils classes. Therefore, clients don't have to know where the
information is located, they can simply invoke this class.
- Version:
- $Id: RepositoryFileManager.java 394 2009-08-10 20:08:46Z jkealey $
- Author:
- Manuel Schulze, Steffen Pingel, Jason Kealey invalid input: '<'jkealey@shade.ca>
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryFileManager(String pathName) Creates a new instance with root atpathName. -
Method Summary
Modifier and TypeMethodDescriptionabsolutePathToUrl(String absolute) Converts an absolute path in the repository to a URL, using the repository URLabsoluteToRelativePath(String stringData) Converts an absolute path in the repository to a path relative to the working folder root.voidaddDirectory(String relativePath) Adds a directory to the list of known directories.booleanexistsInWorkingCopy(String relativePath) Returns true if the file exists in the working copy (according to the svn metadata, and not file system checks).protected ISvnDiffProcessorprotected ISvnInfoProcessorprotected intgetLineCount(BufferedReader reader) Counts lines on a BufferedReaderint[]getLineDiff(String oldRevNr, String newRevNr, String filename) Returns line count differences between two revisions of a file.intgetLinesOfCode(String filename) Returns the lines of code for a repository file.Assumes #loadInfo(String) has been called.protected ISvnPropgetProcessorAssumes #loadInfo(String) has been called.getRevision(String filename) Returns the revision of filename in the local working directory by reading the svn metadata.getRevisionDiff(String newRevNr) Returns line count differences for all files in a particular revision.Assumes #loadInfo(String) has been called.protected ISvnVersionProcessorbooleanIs the given path a binary file in the working directory?booleanisDirectory(String relativePath) Returns true if the path has been identified as a directory.voidloadInfo()Initializes our representation of the repository.relativePathToUrl(String relative) Converts a relative path in the working folder to a URL, using the working folder's root URLrelativeToAbsolutePath(String relative) Converts a relative path in the working folder to an absolute path in the repository.urlToAbsolutePath(String url) Converts a url to an absolute path in the repository.urlToRelativePath(String url) Converts a url to a relative path in the repository.
-
Constructor Details
-
RepositoryFileManager
Creates a new instance with root atpathName.- Parameters:
pathName- the root of the checked out repository
-
-
Method Details
-
absolutePathToUrl
-
absoluteToRelativePath
Converts an absolute path in the repository to a path relative to the working folder root. Will return null if absolute path does not start with getModuleName();- Parameters:
absolute- Example (assume getModuleName() returns /trunk/statsvn) /trunk/statsvn/package.html- Returns:
- Example: package.html
-
addDirectory
Adds a directory to the list of known directories. Used when inferring implicit actions on deleted paths.- Parameters:
relativePath- the relative path.
-
existsInWorkingCopy
Returns true if the file exists in the working copy (according to the svn metadata, and not file system checks).- Parameters:
relativePath- the path- Returns:
- true if it exists
-
getLineCount
Counts lines on a BufferedReader- Parameters:
reader- the buffered reader- Returns:
- the number of lines read
- Throws:
IOException- error reading from reader
-
getLineDiff
public int[] getLineDiff(String oldRevNr, String newRevNr, String filename) throws IOException, BinaryDiffException Returns line count differences between two revisions of a file.- 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.
-
getRevisionDiff
Returns line count differences for all files in a particular revision.- 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.
-
getLinesOfCode
Returns the lines of code for a repository file. (Currently checked out version)- Parameters:
filename- a file in the repository- Returns:
- the lines of code for a repository file
- Throws:
net.sf.statcvs.input.NoLineCountException- when the line count could not be retrieved, for example when the file was not found.
-
getModuleName
Assumes #loadInfo(String) has been called. Never ends with /, might be empty.- Returns:
- The absolute path of the root of the working folder in the repository.
-
getRepositoryUuid
Assumes #loadInfo(String) has been called.- Returns:
- The uuid of the repository.
-
getRevision
Returns the revision of filename in the local working directory by reading the svn metadata.- Parameters:
filename- the filename- Returns:
- the revision of filename
- Throws:
IOException
-
getRootRevisionNumber
Assumes #loadInfo(String) has been called.- Returns:
- the revision number of the root of the working folder (last checked out revision number)
-
isBinary
Is the given path a binary file in the working directory?- Parameters:
relativePath- the directory- Returns:
- true if it is marked as a binary file
-
isDirectory
Returns true if the path has been identified as a directory.- Parameters:
relativePath- the path- Returns:
- true if it is a known directory.
-
loadInfo
Initializes our representation of the repository.- Throws:
net.sf.statcvs.input.LogSyntaxException- if the svn info --xml is malformedIOException- if there is an error reading from the stream
-
relativePathToUrl
-
relativeToAbsolutePath
-
urlToAbsolutePath
-
urlToRelativePath
-
getProcessor
-
getDiffProcessor
-
getInfoProcessor
-
getPropgetProcessor
-
getVersionProcessor
-