The
SVNLookClient class provides API for examining
different aspects of a Subversion repository. Its functionality
is similar to the one of the Subversion command-line utility
called
svnlook. The following table matches methods of
SVNLookClient to the corresponding commands of the
svnlook utility (to make sense what its different methods
are for):
| SVNLookClient | Subversion |
| doCat() | 'svnlook cat' |
| doGetAuthor() | 'svnlook author' |
| doGetChanged() | 'svnlook changed' |
| doGetChangedDirectories() | 'svnlook dirs-changed' |
| doGetDate() | 'svnlook date' |
| doGetDiff() | 'svnlook diff' |
| doGetHistory() | 'svnlook history' |
| doGetInfo() | 'svnlook info' |
| doGetLock() | 'svnlook lock' |
| doGetLog() | 'svnlook log' |
| doGetProperties() | 'svnlook proplist' |
| doGetProperty() | 'svnlook propget' |
| doGetRevisionProperties() | 'svnlook proplist --revprop' |
| doGetRevisionProperty() | 'svnlook propget --revprop' |
| doGetTree() | 'svnlook tree' |
| doGetUUID() | 'svnlook uuid' |
| doGetYoungestRevision() | 'svnlook youngest' |
doCat
public void doCat(File repositoryRoot,
String path,
String transactionName,
OutputStream out)
throws SVNException Fetches file contents for the specified path in the given
transaction. path must be absolute, that is it
must start with '/'. The provided output stream
is not closed within this method.
repositoryRoot - a repository root directory pathpath - an absolute file pathtransactionName - a transaction nameout - an output stream to write contents to
SVNException - - no repository is found at
repositoryRoot
- if
path is not found or
is not a file
- if the specified transaction is not found
doCat
public void doCat(File repositoryRoot,
String path,
SVNRevision revision,
OutputStream out)
throws SVNException Fetches file contents for the specified revision and path.
path must be absolute, that is it must
start with '/'. The provided output stream is
not closed within this method.
repositoryRoot - a repository root directory pathpath - an absolute file pathrevision - a revision numberout - an output stream to write contents to
SVNException - - no repository is found at
repositoryRoot
- if
path is not found or
is not a file
doGetAuthor
public String doGetAuthor(File repositoryRoot,
String transactionName)
throws SVNException Returns author information for the given transaction.
repositoryRoot - a repository root directory pathtransactionName - a transaction name
SVNException - - no repository is found at
repositoryRoot - if the specified transaction is not found
doGetAuthor
public String doGetAuthor(File repositoryRoot,
SVNRevision revision)
throws SVNException Returns author information for the given revision.
repositoryRoot - a repository root directory pathrevision - a revision number
doGetChanged
public void doGetChanged(File repositoryRoot,
String transactionName,
ISVNChangeEntryHandler handler,
boolean includeCopyInfo)
throws SVNException Traverses changed paths for the given transaction invoking
the passed handler on each changed path.
repositoryRoot - a repository root directory pathtransactionName - a transaction namehandler - a changed path handlerincludeCopyInfo - if true copy-from
information is also provided for copied paths
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetChanged
public void doGetChanged(File repositoryRoot,
SVNRevision revision,
ISVNChangeEntryHandler handler,
boolean includeCopyInfo)
throws SVNException Traverses changed paths for the given revision invoking
the passed handler on each changed path.
repositoryRoot - a repository root directory pathrevision - a revision numberhandler - a changed path handlerincludeCopyInfo - if true copy-from
information is also provided for copied paths
doGetChangedDirectories
public void doGetChangedDirectories(File repositoryRoot,
String transactionName,
ISVNChangedDirectoriesHandler handler)
throws SVNException Passes paths of directories changed in the given transaction to the provided handler.
Paths are absolute (start with '/').
repositoryRoot - a repository root directory pathtransactionName - a transaction namehandler - a path handler
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetChangedDirectories
public void doGetChangedDirectories(File repositoryRoot,
SVNRevision revision,
ISVNChangedDirectoriesHandler handler)
throws SVNException Passes paths of directories changed in the given revision to the provided handler.
Paths are absolute (start with '/').
repositoryRoot - a repository root directory pathrevision - a revision numberhandler - a path handler
doGetDate
public Date doGetDate(File repositoryRoot,
String transactionName)
throws SVNException Returns datestamp information for the given transaction.
repositoryRoot - a repository root directory pathtransactionName - a transaction name
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetDate
public Date doGetDate(File repositoryRoot,
SVNRevision revision)
throws SVNException Returns datestamp information for the given revision.
repositoryRoot - a repository root directory pathrevision - a revision number
doGetDiff
public void doGetDiff(File repositoryRoot,
String transactionName,
boolean diffDeleted,
boolean diffAdded,
boolean diffCopyFrom,
OutputStream os)
throws SVNException Writes differences of changed files and properties for the
given transaction to the provided output stream. If no special diff generator
was provided to
this client a default GNU-style diff generator is used (which
writes differences just like the
'svnlook diff' command).
repositoryRoot - a repository root directory pathtransactionName - a transaction namediffDeleted - if true
differences for deleted files are included,
otherwise notdiffAdded - if true
differences for added files are included,
otherwise notdiffCopyFrom - if true
writes differences against the copy source
(if any), otherwise notos - an output stream to write differences to
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetDiff
public void doGetDiff(File repositoryRoot,
SVNRevision revision,
boolean diffDeleted,
boolean diffAdded,
boolean diffCopyFrom,
OutputStream os)
throws SVNException Writes differences of changed files and properties for the
given revision to the provided output stream. If no special diff generator
was provided to
this client a default GNU-style diff generator is used (which
writes differences just like the
'svnlook diff' command).
The provided output stream is not closed within this method.
repositoryRoot - a repository root directory pathrevision - a revision numberdiffDeleted - if true
differences for deleted files are included,
otherwise notdiffAdded - if true
differences for added files are included,
otherwise notdiffCopyFrom - if true
writes differences against the copy source
(if any), otherwise notos - an output stream to write differences to
doGetHistory
public void doGetHistory(File repositoryRoot,
String path,
SVNRevision revision,
boolean includeIDs,
ISVNHistoryHandler handler)
throws SVNException Passes history information for the specified path and revision to the provided handler.
This information is provided as
SVNAdminPath objects and include the following
pieces:
For history retrieval only these listed
get methods of
SVNAdminPath are
relevant.
path must be absolute, that is it must start with
'/'.
If
path is
null it defaults to
"/".
repositoryRoot - a repository root directory pathpath - an absolute pathrevision - a revision numberincludeIDs - if true a node
revision id is also included for each pathhandler - a history handler
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
doGetInfo
public SVNLogEntry doGetInfo(File repositoryRoot,
String transactionName)
throws SVNException Retrieves author, timestamp and log message information from
the repository for the given transaction name. This information is
provided in a single
SVNLogEntry
object, that is only the following methods of
SVNLogEntry
return valid information:
repositoryRoot - a repository root directory pathtransactionName - a transaction name
SVNException - - no repository is found at
repositoryRoot - if the specified transaction is not found
doGetInfo
public SVNLogEntry doGetInfo(File repositoryRoot,
SVNRevision revision)
throws SVNException Retrieves author, timestamp and log message information from
the repository for the given revision. This information is
provided in a single
SVNLogEntry
object, that is only the following methods of
SVNLogEntry
return valid information:
repositoryRoot - a repository root directory pathrevision - a revision number
doGetLock
public SVNLock doGetLock(File repositoryRoot,
String path)
throws SVNException Retrieves lock information for the specified path.
path must be absolute, that is it must start with '/'.
repositoryRoot - a repository root directory pathpath - an absolute path
- an object containing details of a lock or
null if the
path is not locked
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
doGetLog
public String doGetLog(File repositoryRoot,
String transactionName)
throws SVNException Returns log information for the given transaction.
repositoryRoot - a repository root directory pathtransactionName - a transaction name
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetLog
public String doGetLog(File repositoryRoot,
SVNRevision revision)
throws SVNException Returns log information for the given revision.
repositoryRoot - a repository root directory pathrevision - a revision number
doGetProperties
public Map doGetProperties(File repositoryRoot,
String path,
String transactionName)
throws SVNException Returns versioned properties for the specified path in the
given transaction.
path must be absolute, that is it must start with
'/'.
repositoryRoot - a repository root directory pathpath - an absolute pathtransactionName - a transaction name
- name (String) to value (String) mappings
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
- if the specified transaction is not found
doGetProperties
public Map doGetProperties(File repositoryRoot,
String path,
SVNRevision revision)
throws SVNException Returns versioned properties for the specified path in the
given revision.
path must be absolute, that is it must start with
'/'.
repositoryRoot - a repository root directory pathpath - an absolute pathrevision - a revision number
- name (String) to value (String) mappings
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
doGetProperty
public String doGetProperty(File repositoryRoot,
String propName,
String path,
String transactionName)
throws SVNException Returns the value of a versioned property for the specified path in the
given transaction.
path must be absolute, that is it must start with
'/'.
repositoryRoot - a repository root directory pathpropName - a property namepath - an absolute pathtransactionName - a transaction name
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
- if the specified transaction is not found
doGetProperty
public String doGetProperty(File repositoryRoot,
String propName,
String path,
SVNRevision revision)
throws SVNException Returns the value of a versioned property for the specified path in the
given revision.
path must be absolute, that is it must start with
'/'.
repositoryRoot - a repository root directory pathpropName - a property namepath - an absolute pathrevision - a revision number
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
doGetRevisionProperties
public Map doGetRevisionProperties(File repositoryRoot,
String transactionName)
throws SVNException Returns revision properties for the given transaction.
repositoryRoot - a repository root directory pathtransactionName - a transaction name
- name (String) to value (String) mappings
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetRevisionProperties
public Map doGetRevisionProperties(File repositoryRoot,
SVNRevision revision)
throws SVNException Returns revision properties in the given revision.
repositoryRoot - a repository root directory pathrevision - a revision number
- name (String) to value (String) mappings
doGetRevisionProperty
public String doGetRevisionProperty(File repositoryRoot,
String propName,
String transactionName)
throws SVNException Returns the value of a revision property for the given transaction.
repositoryRoot - a repository root directory pathpropName - a property nametransactionName - a transaction name
- the value of a revision property
SVNException - - no repository is found at
repositoryRoot
- if the specified transaction is not found
doGetRevisionProperty
public String doGetRevisionProperty(File repositoryRoot,
String propName,
SVNRevision revision)
throws SVNException Returns the value of a revision property in the given revision.
repositoryRoot - a repository root directory pathpropName - a property namerevision - a revision number
- the value of a revision property
doGetTree
public void doGetTree(File repositoryRoot,
String path,
String transactionName,
boolean includeIDs,
ISVNTreeHandler handler)
throws SVNException Traverses repository tree starting at the specified path in the
given transaction and invoking the provided handler on each path.
Path information is provided as
SVNAdminPath objects and
include the following pieces:
For tree retrieval only these listed
get methods of
SVNAdminPath are
relevant.
path must be absolute, that is it must start with
'/'.
If
path is
null it defaults to
"/".
repositoryRoot - a repository root directory pathpath - an absolute pathtransactionName - a transaction nameincludeIDs - if true a node
revision id is also included for each pathhandler - a tree handler
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
- if the specified transaction is not found
doGetTree
public void doGetTree(File repositoryRoot,
String path,
SVNRevision revision,
boolean includeIDs,
ISVNTreeHandler handler)
throws SVNException Traverses repository tree starting at the specified path in the
given revision and invoking the provided handler on each path.
Path information is provided as
SVNAdminPath objects and
include the following pieces:
For tree retrieval only these listed
get methods of
SVNAdminPath are
relevant.
path must be absolute, that is it must start with
'/'.
If
path is
null it defaults to
"/".
repositoryRoot - a repository root directory pathpath - an absolute pathrevision - a revision numberincludeIDs - if true a node
revision id is also included for each pathhandler - a tree handler
SVNException - - no repository is found at
repositoryRoot
- if
path is not found
doGetUUID
public String doGetUUID(File repositoryRoot)
throws SVNException Returns the uuid of the repository.
repositoryRoot - a repository root directory path
doGetYoungestRevision
public long doGetYoungestRevision(File repositoryRoot)
throws SVNException Returns the latest revision of the repository.
repositoryRoot - a repository root directory path
getDiffGenerator
public ISVNGNUDiffGenerator getDiffGenerator()
Returns a diff generator to be used in doGetDiff() methods of this class.
If no generator was provided by a caller, SVNLookClient uses a default one
that prints differences in a GNU-style.
setDiffGenerator
public void setDiffGenerator(ISVNGNUDiffGenerator diffGenerator)
Sets a diff generator to be used in doGetDiff() methods of this class.