Package org.tmatesoft.svn.core.wc.admin
Class SVNLookClient
java.lang.Object
org.tmatesoft.svn.core.wc.admin.SVNAdminBasicClient
org.tmatesoft.svn.core.wc.admin.SVNLookClient
- All Implemented Interfaces:
ISVNCanceller
,ISVNEventHandler
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
- Version:
- 1.3
-
Field Summary
FieldsFields inherited from interface org.tmatesoft.svn.core.ISVNCanceller
NULL
Fields inherited from interface org.tmatesoft.svn.core.wc.ISVNEventHandler
UNKNOWN
-
Constructor Summary
ConstructorsConstructorDescriptionSVNLookClient
(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 anSVNRepository
} drivers provider and global options keeper. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
catFile
(FSRoot root, String path, OutputStream out) void
doCat
(File repositoryRoot, String path, String transactionName, OutputStream out) Fetches file contents for the specified path in the given transaction.void
doCat
(File repositoryRoot, String path, SVNRevision revision, OutputStream out) Fetches file contents for the specified revision and path.doGetAuthor
(File repositoryRoot, String transactionName) Returns author information for the given transaction.doGetAuthor
(File repositoryRoot, SVNRevision revision) Returns author information for the given revision.void
doGetChanged
(File repositoryRoot, String transactionName, ISVNChangeEntryHandler handler, boolean includeCopyInfo) Traverses changed paths for the given transaction invoking the passed handler on each changed path.void
doGetChanged
(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
(File repositoryRoot, String transactionName, ISVNChangedDirectoriesHandler handler) Passes paths of directories changed in the given transaction to the provided handler.void
doGetChangedDirectories
(File repositoryRoot, SVNRevision revision, ISVNChangedDirectoriesHandler handler) Passes paths of directories changed in the given revision to the provided handler.Returns datestamp information for the given transaction.doGetDate
(File repositoryRoot, SVNRevision revision) Returns datestamp information for the given revision.void
doGetDiff
(File repositoryRoot, String transactionName, boolean diffDeleted, boolean diffAdded, boolean diffCopyFrom, OutputStream os) Writes differences of changed files and properties for the given transaction to the provided output stream.void
doGetDiff
(File repositoryRoot, SVNRevision revision, boolean diffDeleted, boolean diffAdded, boolean diffCopyFrom, OutputStream os) Writes differences of changed files and properties for the given revision to the provided output stream.long
doGetFileSize
(File repositoryRoot, String path, String transactionName) Returns the size in bytes for the specified path in given transactionlong
doGetFileSize
(File repositoryRoot, String path, SVNRevision revision) Returns the size in bytes for the specified path in given revisionvoid
doGetHistory
(File repositoryRoot, String path, SVNRevision revision, boolean includeIDs, long limit, ISVNHistoryHandler handler) Passes history information for the specified path and revision to the provided handler.Retrieves author, timestamp and log message information from the repository for the given transaction name.doGetInfo
(File repositoryRoot, SVNRevision revision) Retrieves author, timestamp and log message information from the repository for the given revision.Retrieves lock information for the specified path.Returns log information for the given transaction.doGetLog
(File repositoryRoot, SVNRevision revision) Returns log information for the given revision.doGetProperties
(File repositoryRoot, String path, String transactionName) Returns versioned properties for the specified path in the given transaction.doGetProperties
(File repositoryRoot, String path, SVNRevision revision) Returns versioned properties for the specified path in the given revision.doGetProperty
(File repositoryRoot, String propName, String path, String transactionName) Returns the value of a versioned property for the specified path in the given transaction.doGetProperty
(File repositoryRoot, String propName, String path, SVNRevision revision) Returns the value of a versioned property for the specified path in the given revision.doGetRevisionProperties
(File repositoryRoot, String transactionName) Returns revision properties for the given transaction.doGetRevisionProperties
(File repositoryRoot, SVNRevision revision) Returns revision properties in the given revision.doGetRevisionProperty
(File repositoryRoot, String propName, String transactionName) Returns the value of a revision property for the given transaction.doGetRevisionProperty
(File repositoryRoot, String propName, SVNRevision revision) Returns the value of a revision property in the given revision.void
doGetTree
(File repositoryRoot, String path, 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
(File repositoryRoot, 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.Returns the uuid of the repository.long
doGetYoungestRevision
(File repositoryRoot) Returns the latest revision of the repository.private SVNNodeEditor
generateDeltaTree
(FSFS fsfs, FSRoot root, long baseRevision) Returns a diff generator to be used indoGetDiff()
methods of this class.private long
getFileSize
(FSRoot root, String path) private void
getHistory
(FSFS fsfs, String path, long start, long end, long limit, boolean crossCopies, boolean includeIDs, ISVNHistoryHandler handler) private SVNProperties
getProperties
(File repositoryRoot, String propName, String path, SVNRevision revision, String txnName, boolean singleProp, boolean revProps) private void
getTree
(FSFS fsfs, FSRoot root, String path, SVNNodeKind kind, FSID id, boolean includeIDs, int depth, boolean recursive, ISVNTreeHandler handler) private FSFS
private FSFS
open
(File repositoryRoot, SVNRevision revision) void
setDiffGenerator
(ISVNGNUDiffGenerator diffGenerator) Sets a diff generator to be used indoGetDiff()
methods of this class.private SVNNodeKind
verifyPath
(FSRoot root, String path) Methods inherited from class org.tmatesoft.svn.core.wc.admin.SVNAdminBasicClient
checkCancelled, createRepository, dispatchEvent, getDebugLog, getEventDispatcher, getOptions, handleEvent, setDebugLog, setEventHandler, setOptions
-
Field Details
-
myDiffGenerator
-
-
Constructor Details
-
SVNLookClient
Creates a new instance of SVNLookClient given an authentication manager and global options keeper.- Parameters:
authManager
- a manager which provides authentication credentialsoptions
- a global config options provider
-
SVNLookClient
Creates a new instance of SVNLookClient given anSVNRepository
} drivers provider and global options keeper.- Parameters:
repositoryPool
- a repository connectors keeperoptions
- a global config options provider
-
SVNLookClient
-
-
Method Details
-
doGetInfo
Retrieves author, timestamp and log message information from the repository for the given revision. This information is provided in a singleSVNLogEntry
object, that is only the following methods of SVNLogEntry return valid information:- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision number- Returns:
- revision info
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetInfo
Retrieves author, timestamp and log message information from the repository for the given transaction name. This information is provided in a singleSVNLogEntry
object, that is only the following methods of SVNLogEntry return valid information:- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction name- Returns:
- transaction info
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
doGetYoungestRevision
Returns the latest revision of the repository.- Parameters:
repositoryRoot
- a repository root directory path- Returns:
- a revision number
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetUUID
Returns the uuid of the repository.- Parameters:
repositoryRoot
- a repository root directory path- Returns:
- an uuid
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetAuthor
Returns author information for the given revision.- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision number- Returns:
- a revision author
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetAuthor
Returns author information for the given transaction.- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction name- Returns:
- a transaction owner
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
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.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute file pathrevision
- a revision numberout
- 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
- no repository is found at
-
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.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute file pathtransactionName
- a transaction nameout
- 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
- no repository is found at
-
doGetDate
Returns datestamp information for the given revision.- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision number- Returns:
- a datestamp
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetDate
Returns datestamp information for the given transaction.- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction name- Returns:
- a datestamp
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
doGetLog
Returns log information for the given revision.- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision number- Returns:
- a log message
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetLog
Returns log information for the given transaction.- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction name- Returns:
- a log message
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
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.- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision numberhandler
- a changed path handlerincludeCopyInfo
- if true copy-from information is also provided for copied paths- Throws:
SVNException
- no repository is found atrepositoryRoot
-
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.- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction namehandler
- a changed path handlerincludeCopyInfo
- 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
- no repository is found at
-
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'/'
).- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision numberhandler
- a path handler- Throws:
SVNException
- no repository is found atrepositoryRoot
-
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'/'
).- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- a transaction namehandler
- a path handler- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
doGetHistory
public void doGetHistory(File repositoryRoot, 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 asSVNAdminPath
objects and include the following pieces:- path (use
SVNAdminPath.getPath()
to retrieve it) - revision (use
SVNAdminPath.getRevision()
to retrieve it) - node id (optional, use
SVNAdminPath.getNodeID()
to retrieve it)
get
methods of SVNAdminPath are relevant.path
must be absolute, that is it must start with'/'
. Ifpath
is null it defaults to"/"
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute pathrevision
- a revision numberincludeIDs
- if true a node revision id is also included for each pathlimit
- maximum number of history entries; if<=0
, then no limitation is applied and all history entries are reportedhandler
- a history handler- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if
path
is not found
- no repository is found at
- path (use
-
doGetLock
Retrieves lock information for the specified path.path
must be absolute, that is it must start with'/'
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- 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
- no repository is found at
-
doGetTree
public void doGetTree(File repositoryRoot, 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 asSVNAdminPath
objects and include the following pieces:- path (use
SVNAdminPath.getPath()
to retrieve it) - tree depth starting from
0
atpath
(useSVNAdminPath.getTreeDepth()
to retrieve it) - node id (optional, use
SVNAdminPath.getNodeID()
to retrieve it) - file/dir information (use
SVNAdminPath.isDir()
to retrieve it)
get
methods of SVNAdminPath are relevant.path
must be absolute, that is it must start with'/'
. Ifpath
is null it defaults to"/"
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute pathrevision
- a revision numberincludeIDs
- if true a node revision id is also included for each pathrecursive
- whether to descend recursively or operate on a single directory onlyhandler
- a tree handler- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if
path
is not found
- no repository is found at
- path (use
-
doGetTree
public void doGetTree(File repositoryRoot, String path, 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 asSVNAdminPath
objects and include the following pieces:- path (use
SVNAdminPath.getPath()
to retrieve it) - tree depth starting from
0
atpath
(useSVNAdminPath.getTreeDepth()
to retrieve it) - node id (optional, use
SVNAdminPath.getNodeID()
to retrieve it) - file/dir information (use
SVNAdminPath.isDir()
to retrieve it)
get
methods of SVNAdminPath are relevant.path
must be absolute, that is it must start with'/'
. Ifpath
is null it defaults to"/"
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute pathtransactionName
- a transaction nameincludeIDs
- if true a node revision id is also included for each pathrecursive
- whether to descend recursively or operate on a single directory onlyhandler
- a tree handler- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if
path
is not found - if the specified transaction is not found
- no repository is found at
- path (use
-
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 generatorwas 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 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- Throws:
SVNException
- no repository is found atrepositoryRoot
-
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 generatorwas 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 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- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
doGetProperty
public SVNPropertyValue 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'/'
.- Parameters:
repositoryRoot
- a repository root directory pathpropName
- a property namepath
- an absolute pathrevision
- a revision number- Returns:
- the value of a property
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if
path
is not found
- no repository is found at
-
doGetProperties
public SVNProperties 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'/'
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute pathrevision
- a revision number- Returns:
- name (String) to value (String) mappings
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if
path
is not found
- no repository is found at
-
doGetProperty
public SVNPropertyValue 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'/'
.- Parameters:
repositoryRoot
- a repository root directory pathpropName
- a property namepath
- an absolute pathtransactionName
- 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
- no repository is found at
-
doGetProperties
public SVNProperties 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'/'
.- Parameters:
repositoryRoot
- a repository root directory pathpath
- an absolute pathtransactionName
- 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
- no repository is found at
-
doGetRevisionProperty
public SVNPropertyValue doGetRevisionProperty(File repositoryRoot, String propName, SVNRevision revision) throws SVNException Returns the value of a revision property in the given revision.- Parameters:
repositoryRoot
- a repository root directory pathpropName
- a property namerevision
- a revision number- Returns:
- the value of a revision property
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetRevisionProperties
public SVNProperties doGetRevisionProperties(File repositoryRoot, SVNRevision revision) throws SVNException Returns revision properties in the given revision.- Parameters:
repositoryRoot
- a repository root directory pathrevision
- a revision number- Returns:
- name (String) to value (String) mappings
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
doGetRevisionProperty
public SVNPropertyValue doGetRevisionProperty(File repositoryRoot, String propName, String transactionName) throws SVNException Returns the value of a revision property for the given transaction.- Parameters:
repositoryRoot
- a repository root directory pathpropName
- a property nametransactionName
- 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
- no repository is found at
-
doGetRevisionProperties
public SVNProperties doGetRevisionProperties(File repositoryRoot, String transactionName) throws SVNException Returns revision properties for the given transaction.- Parameters:
repositoryRoot
- a repository root directory pathtransactionName
- 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
- no repository is found at
-
doGetFileSize
public long doGetFileSize(File repositoryRoot, String path, String transactionName) throws SVNException Returns the size in bytes for the specified path in given transaction- Parameters:
repositoryRoot
- a repository root directory pathpath
- a path to the file inside the repositorytransactionName
- a transaction name- Returns:
- file size in bytes
- Throws:
SVNException
-- no repository is found at
repositoryRoot
- if the specified transaction is not found
- no repository is found at
-
doGetFileSize
public long doGetFileSize(File repositoryRoot, String path, SVNRevision revision) throws SVNException Returns the size in bytes for the specified path in given revision- Parameters:
repositoryRoot
- a repository root directory pathpath
- a path to the file inside the repositoryrevision
- a revision- Returns:
- file size in bytes
- Throws:
SVNException
- no repository is found atrepositoryRoot
-
setDiffGenerator
Sets a diff generator to be used indoGetDiff()
methods of this class.- Parameters:
diffGenerator
-- See Also:
-
getDiffGenerator
Returns a diff generator to be used indoGetDiff()
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:
-
getTree
private void getTree(FSFS fsfs, FSRoot root, String path, SVNNodeKind kind, FSID id, boolean includeIDs, int depth, boolean recursive, ISVNTreeHandler handler) throws SVNException - Throws:
SVNException
-
getProperties
private SVNProperties getProperties(File repositoryRoot, String propName, String path, SVNRevision revision, String txnName, boolean singleProp, boolean revProps) throws SVNException - Throws:
SVNException
-
getHistory
private void getHistory(FSFS fsfs, String path, long start, long end, long limit, boolean crossCopies, boolean includeIDs, ISVNHistoryHandler handler) throws SVNException - Throws:
SVNException
-
generateDeltaTree
private SVNNodeEditor generateDeltaTree(FSFS fsfs, FSRoot root, long baseRevision) throws SVNException - Throws:
SVNException
-
catFile
- Throws:
SVNException
-
getFileSize
- Throws:
SVNException
-
verifyPath
- Throws:
SVNException
-
open
- Throws:
SVNException
-
open
- Throws:
SVNException
-