org.tmatesoft.svn.core.wc.admin
Class SVNLookClient

java.lang.Object
  extended by org.tmatesoft.svn.core.wc.admin.SVNAdminBasicClient
      extended by org.tmatesoft.svn.core.wc.admin.SVNLookClient
All Implemented Interfaces:
ISVNCanceller, ISVNEventHandler

public class SVNLookClient
extends SVNAdminBasicClient

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'

Since:
1.2

Field Summary
 
Fields inherited from interface org.tmatesoft.svn.core.wc.ISVNEventHandler
UNKNOWN
 
Fields inherited from interface org.tmatesoft.svn.core.ISVNCanceller
NULL
 
Constructor Summary
SVNLookClient(ISVNAuthenticationManager authManager, ISVNOptions options)
          Creates a new instance of SVNLookClient given an authentication manager and global options keeper.
SVNLookClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
          Creates a new instance of SVNLookClient given an SVNRepository} drivers provider and global options keeper.
 
Method Summary
 void doCat(java.io.File repositoryRoot, java.lang.String path, java.lang.String transactionName, java.io.OutputStream out)
          Fetches file contents for the specified path in the given transaction.
 void doCat(java.io.File repositoryRoot, java.lang.String path, SVNRevision revision, java.io.OutputStream out)
          Fetches file contents for the specified revision and path.
 java.lang.String doGetAuthor(java.io.File repositoryRoot, java.lang.String transactionName)
          Returns author information for the given transaction.
 java.lang.String doGetAuthor(java.io.File repositoryRoot, SVNRevision revision)
          Returns author information for the given revision.
 void doGetChanged(java.io.File repositoryRoot, java.lang.String transactionName, ISVNChangeEntryHandler handler, boolean includeCopyInfo)
          Traverses changed paths for the given transaction invoking the passed handler on each changed path.
 void doGetChanged(java.io.File repositoryRoot, SVNRevision revision, ISVNChangeEntryHandler handler, boolean includeCopyInfo)
          Traverses changed paths for the given revision invoking the passed handler on each changed path.
 void doGetChangedDirectories(java.io.File repositoryRoot, java.lang.String transactionName, ISVNChangedDirectoriesHandler handler)
          Passes paths of directories changed in the given transaction to the provided handler.
 void doGetChangedDirectories(java.io.File repositoryRoot, SVNRevision revision, ISVNChangedDirectoriesHandler handler)
          Passes paths of directories changed in the given revision to the provided handler.
 java.util.Date doGetDate(java.io.File repositoryRoot, java.lang.String transactionName)
          Returns datestamp information for the given transaction.
 java.util.Date doGetDate(java.io.File repositoryRoot, SVNRevision revision)
          Returns datestamp information for the given revision.
 void doGetDiff(java.io.File repositoryRoot, java.lang.String transactionName, boolean diffDeleted, boolean diffAdded, boolean diffCopyFrom, java.io.OutputStream os)
          Writes differences of changed files and properties for the given transaction to the provided output stream.
 void doGetDiff(java.io.File repositoryRoot, SVNRevision revision, boolean diffDeleted, boolean diffAdded, boolean diffCopyFrom, java.io.OutputStream os)
          Writes differences of changed files and properties for the given revision to the provided output stream.
 void doGetHistory(java.io.File repositoryRoot, java.lang.String path, SVNRevision revision, boolean includeIDs, long limit, ISVNHistoryHandler handler)
          Passes history information for the specified path and revision to the provided handler.
 SVNLogEntry doGetInfo(java.io.File repositoryRoot, java.lang.String transactionName)
          Retrieves author, timestamp and log message information from the repository for the given transaction name.
 SVNLogEntry doGetInfo(java.io.File repositoryRoot, SVNRevision revision)
          Retrieves author, timestamp and log message information from the repository for the given revision.
 SVNLock doGetLock(java.io.File repositoryRoot, java.lang.String path)
          Retrieves lock information for the specified path.
 java.lang.String doGetLog(java.io.File repositoryRoot, java.lang.String transactionName)
          Returns log information for the given transaction.
 java.lang.String doGetLog(java.io.File repositoryRoot, SVNRevision revision)
          Returns log information for the given revision.
 SVNProperties doGetProperties(java.io.File repositoryRoot, java.lang.String path, java.lang.String transactionName)
          Returns versioned properties for the specified path in the given transaction.
 SVNProperties doGetProperties(java.io.File repositoryRoot, java.lang.String path, SVNRevision revision)
          Returns versioned properties for the specified path in the given revision.
 SVNPropertyValue doGetProperty(java.io.File repositoryRoot, java.lang.String propName, java.lang.String path, java.lang.String transactionName)
          Returns the value of a versioned property for the specified path in the given transaction.
 SVNPropertyValue doGetProperty(java.io.File repositoryRoot, java.lang.String propName, java.lang.String path, SVNRevision revision)
          Returns the value of a versioned property for the specified path in the given revision.
 SVNProperties doGetRevisionProperties(java.io.File repositoryRoot, java.lang.String transactionName)
          Returns revision properties for the given transaction.
 SVNProperties doGetRevisionProperties(java.io.File repositoryRoot, SVNRevision revision)
          Returns revision properties in the given revision.
 SVNPropertyValue doGetRevisionProperty(java.io.File repositoryRoot, java.lang.String propName, java.lang.String transactionName)
          Returns the value of a revision property for the given transaction.
 SVNPropertyValue doGetRevisionProperty(java.io.File repositoryRoot, java.lang.String propName, SVNRevision revision)
          Returns the value of a revision property in the given revision.
 void doGetTree(java.io.File repositoryRoot, java.lang.String path, java.lang.String transactionName, boolean includeIDs, boolean recursive, ISVNTreeHandler handler)
          Traverses repository tree starting at the specified path in the given transaction and invoking the provided handler on each path.
 void doGetTree(java.io.File repositoryRoot, java.lang.String path, SVNRevision revision, boolean includeIDs, boolean recursive, ISVNTreeHandler handler)
          Traverses repository tree starting at the specified path in the given revision and invoking the provided handler on each path.
 java.lang.String doGetUUID(java.io.File repositoryRoot)
          Returns the uuid of the repository.
 long doGetYoungestRevision(java.io.File repositoryRoot)
          Returns the latest revision of the repository.
 ISVNGNUDiffGenerator getDiffGenerator()
          Returns a diff generator to be used in doGetDiff() methods of this class.
 void setDiffGenerator(ISVNGNUDiffGenerator diffGenerator)
          Sets a diff generator to be used in doGetDiff() methods of this class.
 
Methods inherited from class org.tmatesoft.svn.core.wc.admin.SVNAdminBasicClient
checkCancelled, createRepository, dispatchEvent, getDebugLog, getEventDispatcher, getOptions, handleEvent, setDebugLog, setEventHandler, setIgnoreExternals, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNLookClient

public SVNLookClient(ISVNAuthenticationManager authManager,
                     ISVNOptions options)
Creates a new instance of SVNLookClient given an authentication manager and global options keeper.

Parameters:
authManager - a manager which provides authentication credentials
options - a global config options provider

SVNLookClient

public SVNLookClient(ISVNRepositoryPool repositoryPool,
                     ISVNOptions options)
Creates a new instance of SVNLookClient given an SVNRepository} drivers provider and global options keeper.

Parameters:
repositoryPool - a repository connectors keeper
options - a global config options provider
Method Detail

doGetInfo

public SVNLogEntry doGetInfo(java.io.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:

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
Returns:
revision info
Throws:
SVNException - no repository is found at repositoryRoot

doGetInfo

public SVNLogEntry doGetInfo(java.io.File repositoryRoot,
                             java.lang.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:

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
Returns:
transaction info
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetYoungestRevision

public long doGetYoungestRevision(java.io.File repositoryRoot)
                           throws SVNException
Returns the latest revision of the repository.

Parameters:
repositoryRoot - a repository root directory path
Returns:
a revision number
Throws:
SVNException - no repository is found at repositoryRoot

doGetUUID

public java.lang.String doGetUUID(java.io.File repositoryRoot)
                           throws SVNException
Returns the uuid of the repository.

Parameters:
repositoryRoot - a repository root directory path
Returns:
an uuid
Throws:
SVNException - no repository is found at repositoryRoot

doGetAuthor

public java.lang.String doGetAuthor(java.io.File repositoryRoot,
                                    SVNRevision revision)
                             throws SVNException
Returns author information for the given revision.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
Returns:
a revision author
Throws:
SVNException - no repository is found at repositoryRoot

doGetAuthor

public java.lang.String doGetAuthor(java.io.File repositoryRoot,
                                    java.lang.String transactionName)
                             throws SVNException
Returns author information for the given transaction.

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
Returns:
a transaction owner
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doCat

public void doCat(java.io.File repositoryRoot,
                  java.lang.String path,
                  SVNRevision revision,
                  java.io.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.

Parameters:
repositoryRoot - a repository root directory path
path - an absolute file path
revision - a revision number
out - an output stream to write contents to
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found or is not a file

doCat

public void doCat(java.io.File repositoryRoot,
                  java.lang.String path,
                  java.lang.String transactionName,
                  java.io.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.

Parameters:
repositoryRoot - a repository root directory path
path - an absolute file path
transactionName - a transaction name
out - an output stream to write contents to
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found or is not a file
  • if the specified transaction is not found

doGetDate

public java.util.Date doGetDate(java.io.File repositoryRoot,
                                SVNRevision revision)
                         throws SVNException
Returns datestamp information for the given revision.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
Returns:
a datestamp
Throws:
SVNException - no repository is found at repositoryRoot

doGetDate

public java.util.Date doGetDate(java.io.File repositoryRoot,
                                java.lang.String transactionName)
                         throws SVNException
Returns datestamp information for the given transaction.

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
Returns:
a datestamp
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetLog

public java.lang.String doGetLog(java.io.File repositoryRoot,
                                 SVNRevision revision)
                          throws SVNException
Returns log information for the given revision.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
Returns:
a log message
Throws:
SVNException - no repository is found at repositoryRoot

doGetLog

public java.lang.String doGetLog(java.io.File repositoryRoot,
                                 java.lang.String transactionName)
                          throws SVNException
Returns log information for the given transaction.

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
Returns:
a log message
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetChanged

public void doGetChanged(java.io.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.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
handler - a changed path handler
includeCopyInfo - if true copy-from information is also provided for copied paths
Throws:
SVNException - no repository is found at repositoryRoot

doGetChanged

public void doGetChanged(java.io.File repositoryRoot,
                         java.lang.String transactionName,
                         ISVNChangeEntryHandler handler,
                         boolean includeCopyInfo)
                  throws SVNException
Traverses changed paths for the given transaction invoking the passed handler on each changed path.

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
handler - a changed path handler
includeCopyInfo - if true copy-from information is also provided for copied paths
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetChangedDirectories

public void doGetChangedDirectories(java.io.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 '/').

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
handler - a path handler
Throws:
SVNException - no repository is found at repositoryRoot

doGetChangedDirectories

public void doGetChangedDirectories(java.io.File repositoryRoot,
                                    java.lang.String transactionName,
                                    ISVNChangedDirectoriesHandler handler)
                             throws SVNException
Passes paths of directories changed in the given transaction to the provided handler. Paths are absolute (start with '/').

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
handler - a path handler
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetHistory

public void doGetHistory(java.io.File repositoryRoot,
                         java.lang.String path,
                         SVNRevision revision,
                         boolean includeIDs,
                         long limit,
                         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 "/".

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
revision - a revision number
includeIDs - if true a node revision id is also included for each path
limit - maximum number of history entries; if <=0, then no limitation is applied and all history entries are reported
handler - a history handler
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found

doGetLock

public SVNLock doGetLock(java.io.File repositoryRoot,
                         java.lang.String path)
                  throws SVNException
Retrieves lock information for the specified path. path must be absolute, that is it must start with '/'.

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
Returns:
an object containing details of a lock or null if the path is not locked
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found

doGetTree

public void doGetTree(java.io.File repositoryRoot,
                      java.lang.String path,
                      SVNRevision revision,
                      boolean includeIDs,
                      boolean recursive,
                      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 "/".

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
revision - a revision number
includeIDs - if true a node revision id is also included for each path
recursive - whether to descend recursively or operate on a single directory only
handler - a tree handler
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found

doGetTree

public void doGetTree(java.io.File repositoryRoot,
                      java.lang.String path,
                      java.lang.String transactionName,
                      boolean includeIDs,
                      boolean recursive,
                      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 "/".

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
transactionName - a transaction name
includeIDs - if true a node revision id is also included for each path
recursive - whether to descend recursively or operate on a single directory only
handler - a tree handler
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found
  • if the specified transaction is not found

doGetDiff

public void doGetDiff(java.io.File repositoryRoot,
                      SVNRevision revision,
                      boolean diffDeleted,
                      boolean diffAdded,
                      boolean diffCopyFrom,
                      java.io.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.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
diffDeleted - if true differences for deleted files are included, otherwise not
diffAdded - if true differences for added files are included, otherwise not
diffCopyFrom - if true writes differences against the copy source (if any), otherwise not
os - an output stream to write differences to
Throws:
SVNException - no repository is found at repositoryRoot

doGetDiff

public void doGetDiff(java.io.File repositoryRoot,
                      java.lang.String transactionName,
                      boolean diffDeleted,
                      boolean diffAdded,
                      boolean diffCopyFrom,
                      java.io.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).

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
diffDeleted - if true differences for deleted files are included, otherwise not
diffAdded - if true differences for added files are included, otherwise not
diffCopyFrom - if true writes differences against the copy source (if any), otherwise not
os - an output stream to write differences to
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetProperty

public SVNPropertyValue doGetProperty(java.io.File repositoryRoot,
                                      java.lang.String propName,
                                      java.lang.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 '/'.

Parameters:
repositoryRoot - a repository root directory path
propName - a property name
path - an absolute path
revision - a revision number
Returns:
the value of a property
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found

doGetProperties

public SVNProperties doGetProperties(java.io.File repositoryRoot,
                                     java.lang.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 '/'.

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
revision - a revision number
Returns:
name (String) to value (String) mappings
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found

doGetProperty

public SVNPropertyValue doGetProperty(java.io.File repositoryRoot,
                                      java.lang.String propName,
                                      java.lang.String path,
                                      java.lang.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 '/'.

Parameters:
repositoryRoot - a repository root directory path
propName - a property name
path - an absolute path
transactionName - a transaction name
Returns:
the value of a property
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found
  • if the specified transaction is not found

doGetProperties

public SVNProperties doGetProperties(java.io.File repositoryRoot,
                                     java.lang.String path,
                                     java.lang.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 '/'.

Parameters:
repositoryRoot - a repository root directory path
path - an absolute path
transactionName - a transaction name
Returns:
name (String) to value (String) mappings
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if path is not found
  • if the specified transaction is not found

doGetRevisionProperty

public SVNPropertyValue doGetRevisionProperty(java.io.File repositoryRoot,
                                              java.lang.String propName,
                                              SVNRevision revision)
                                       throws SVNException
Returns the value of a revision property in the given revision.

Parameters:
repositoryRoot - a repository root directory path
propName - a property name
revision - a revision number
Returns:
the value of a revision property
Throws:
SVNException - no repository is found at repositoryRoot

doGetRevisionProperties

public SVNProperties doGetRevisionProperties(java.io.File repositoryRoot,
                                             SVNRevision revision)
                                      throws SVNException
Returns revision properties in the given revision.

Parameters:
repositoryRoot - a repository root directory path
revision - a revision number
Returns:
name (String) to value (String) mappings
Throws:
SVNException - no repository is found at repositoryRoot

doGetRevisionProperty

public SVNPropertyValue doGetRevisionProperty(java.io.File repositoryRoot,
                                              java.lang.String propName,
                                              java.lang.String transactionName)
                                       throws SVNException
Returns the value of a revision property for the given transaction.

Parameters:
repositoryRoot - a repository root directory path
propName - a property name
transactionName - a transaction name
Returns:
the value of a revision property
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

doGetRevisionProperties

public SVNProperties doGetRevisionProperties(java.io.File repositoryRoot,
                                             java.lang.String transactionName)
                                      throws SVNException
Returns revision properties for the given transaction.

Parameters:
repositoryRoot - a repository root directory path
transactionName - a transaction name
Returns:
name (String) to value (String) mappings
Throws:
SVNException -
  • no repository is found at repositoryRoot
  • if the specified transaction is not found

setDiffGenerator

public void setDiffGenerator(ISVNGNUDiffGenerator diffGenerator)
Sets a diff generator to be used in doGetDiff() methods of this class.

Parameters:
diffGenerator -
See Also:
getDiffGenerator()

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.

Returns:
a diff generator
See Also:
setDiffGenerator(ISVNGNUDiffGenerator)