Class SVNStatus
Within the status handler implementation a developer decides how to interpret status information. For some purposes this way may be more flexible in comparison with calling doStatus() that returns an SVNStatus per one local item. However the latter one may be useful when needing to find out the status of the concrete item.
There are two approaches how to process SVNStatus objects:
1. Implementing an ISVNStatusHandler:
import org.tmatesoft.svn.core.wc.ISVNStatusHandler; import org.tmatesoft.svn.core.wc.SVNStatus; import org.tmatesoft.svn.core.wc.SVNStatusType; ... public class MyCustomStatusHandler implements ISVNStatusHandler { public void handleStatus(SVNStatus status) { //parse the item's contents status if(status.getContentsStatus() == SVNStatusType.STATUS_MODIFIED) { ... } else if(status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED) { ... } ... //parse properties status if(status.getPropertiesStatus() == SVNStatusType.STATUS_MODIFIED) { ... } ... } }
...and providing a status handler implementation to an SVNStatusClient's doStatus() method:
... import org.tmatesoft.svn.core.wc.SVNStatusClient; ... SVNStatusClient statusClient; ... statusClient.doStatus(...., new MyCustomStatusHandler()); ...
2. Or process an SVNStatus like this:
... SVNStatus status = statusClient.doStatus(new File(myPath), false); //parsing status info here ...
SVNStatus's methods which names start with getRemote are
relevant for remote status invocations - that is when a doStatus() method of
SVNStatusClient is called with the flag remote set to
true.
- Since:
- 1.2
- Version:
- 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate java.lang.Stringprivate java.lang.Stringprivate java.util.Dateprivate SVNRevisionprivate java.io.Fileprivate java.io.Fileprivate java.io.Fileprivate SVNStatusTypeprivate SVNRevisionprivate java.lang.Stringprivate SVNDepthprivate SVNEntryprivate java.util.Mapprivate java.io.Fileprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate SVNNodeKindprivate java.util.Dateprivate SVNLockprivate java.util.Dateprivate java.io.Fileprivate java.io.Fileprivate SVNStatusTypeprivate SVNStatusTypeprivate java.io.Fileprivate java.lang.Stringprivate SVNStatusTypeprivate java.util.Dateprivate SVNNodeKindprivate SVNLockprivate SVNStatusTypeprivate SVNStatusTypeprivate SVNRevisionprivate SVNURLprivate java.lang.Stringprivate SVNURLprivate java.lang.Stringprivate SVNRevisionprivate SVNTreeConflictDescriptionprivate SVNURLprivate int -
Constructor Summary
ConstructorsConstructorDescriptionSVNStatus(SVNURL url, java.io.File file, SVNNodeKind kind, SVNRevision revision, SVNRevision committedRevision, java.util.Date committedDate, java.lang.String author, SVNStatusType contentsStatus, SVNStatusType propertiesStatus, SVNStatusType remoteContentsStatus, SVNStatusType remotePropertiesStatus, boolean isLocked, boolean isCopied, boolean isSwitched, boolean isFileExternal, java.io.File conflictNewFile, java.io.File conflictOldFile, java.io.File conflictWrkFile, java.io.File projRejectFile, java.lang.String copyFromURL, SVNRevision copyFromRevision, SVNLock remoteLock, SVNLock localLock, java.util.Map entryProperties, java.lang.String changelistName, int wcFormatVersion, SVNTreeConflictDescription treeConflict) Constructs an SVNStatus object filling it with status information details. -
Method Summary
Modifier and TypeMethodDescriptionstatic SVNStatusTypecombineNodeAndContentsStatus(int workingCopyFormat, SVNStatusType nodeStatus, SVNStatusType contentsStatus, boolean versioned, boolean conflicted) static SVNStatusTypecombineRemoteNodeAndContentsStatus(int workingCopyFormat, SVNStatusType remoteNodeStatus, SVNStatusType remoteContentsStatus) java.lang.StringGets the author who last changed the item.java.lang.StringReturns the name of the changelist which the working copy item, denoted by this object, belongs to.java.util.DateGets the timestamp when the item was last changed (committed).Gets the revision when the item was last changed (committed).java.io.FileGets the temporary file that contains all latest changes from the repository which led to a conflict with local changes.java.io.FileGets the temporary BASE revision file of that working file that is currently in conflict with changes received from the repository.java.io.FileGets the temporary '.mine' file with all current local changes to the original file.Gets the Working Copy local item's contents status type.Gets the revision of the item's ancestor from which the item was copied (the item is added with history).java.lang.StringGets the URL (repository location) of the ancestor from which the item was copied.getDepth()getEntry()Returns a WC entry for which this object is generated.java.util.MapGets the item's SVN specific '<entry' properties.java.io.FilegetFile()Gets the item's path in the filesystem.getKind()Gets the item's node kind characterizing it as an entry.Gets the file item's local lock.java.io.Filejava.io.FileGets the Working Copy local item's properties status type.java.io.FileGets the '.prej' file containing details on properties conflicts.java.lang.StringGets the item's last changed author.Gets the Working Copy item's contents status type against the repository - that is comparing the item's BASE revision and the latest one in the repository when the item was changed.java.util.DateGets the item's last changed date.Returns the kind of the item got from the repository.Gets the file item's repository lock - applicable for a remote status invocation.Gets the Working Copy item's properties status type against the repository - that is comparing the item's BASE revision and the latest one in the repository when the item was changed.Gets the item's last committed repository revision.Gets the item's latest repository location.java.lang.Stringjava.lang.StringGets the item's current working revision.Returns a tree conflict description.getURL()Gets the item's repository location.java.util.DateReturns the last modified local time of the file item.intReturns the working copy format number for the admin directory which the statused item is versioned under.java.util.DateReturns the last modified local time of file or directory properties.booleanbooleanisCopied()Finds out if the item is added with history.booleanTells if this is an externals file or not.booleanisLocked()Finds out if the item is locked (not a user lock but a driver's one when during an operation a Working Copy is locked in .svn administrative areas to prevent from other operations interrupting until the running one finishes).booleanFinds out whether the item is switched to a different repository location.booleanvoidMarks the item as an external.voidsetAuthor(java.lang.String author) voidsetChangelistName(java.lang.String changelistName) voidsetCommittedDate(java.util.Date committedDate) voidsetCommittedRevision(SVNRevision committedRevision) voidsetConflicted(boolean isConflicted) voidsetConflictNewFile(java.io.File conflictNewFile) voidsetConflictOldFile(java.io.File conflictOldFile) voidsetConflictWrkFile(java.io.File conflictWrkFile) voidsetContentsStatus(SVNStatusType statusType) Sets the item's contents status type.voidsetCopyFromRevision(SVNRevision copyFromRevision) voidsetCopyFromURL(java.lang.String copyFromURL) voidvoidSets a WC entry for which this object is generated.voidsetEntryProperties(java.util.Map entryProperties) voidsetFile(java.io.File file) voidsetIsConflicted(boolean isConflicted) voidsetIsCopied(boolean isCopied) voidsetIsFileExternal(boolean isFileExternal) voidsetIsLocked(boolean isLocked) voidsetIsSwitched(boolean isSwitched) voidsetIsVersioned(boolean isVersioned) voidsetKind(SVNNodeKind kind) voidsetLocalContentsDate(java.util.Date localContentsDate) voidsetLocalLock(SVNLock localLock) voidsetLocalPropertiesDate(java.util.Date localPropertiesDate) voidsetMovedFromPath(java.io.File path) voidsetMovedToPath(java.io.File path) voidsetNodeStatus(SVNStatusType nodeStatus) voidsetPropertiesStatus(SVNStatusType propertiesStatus) voidsetPropRejectFile(java.io.File propRejectFile) voidsetRemoteAuthor(java.lang.String remoteAuthor) voidsetRemoteContentsStatus(SVNStatusType remoteContentsStatus) voidsetRemoteDate(java.util.Date remoteDate) voidsetRemoteKind(SVNNodeKind remoteKind) voidsetRemoteLock(SVNLock remoteLock) voidsetRemoteNodeStatus(SVNStatusType remoteNodeStatus) voidsetRemotePropertiesStatus(SVNStatusType remotePropertiesStatus) voidsetRemoteRevision(SVNRevision remoteRevision) voidsetRemoteStatus(SVNURL url, SVNStatusType contents, SVNStatusType props, SVNLock lock, SVNNodeKind kind, SVNRevision revision, java.util.Date date, java.lang.String author) Sets the item's remote status.voidsetRemoteStatus(SVNStatusType contents, SVNStatusType props, SVNLock lock, SVNNodeKind kind) Sets the item's remote status.voidsetRemoteURL(SVNURL remoteURL) voidsetRepositoryRelativePath(java.lang.String repositoryRelativePath) voidsetRepositoryRootURL(SVNURL repositoryRootURL) voidsetRepositoryUUID(java.lang.String repositoryUUID) voidsetRevision(SVNRevision revision) voidsetTreeConflict(SVNTreeConflictDescription treeConflict) voidvoidsetWorkingCopyFormat(int workingCopyFormat) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
myURL
-
myFile
private java.io.File myFile -
myKind
-
myRevision
-
myCommittedRevision
-
myCommittedDate
private java.util.Date myCommittedDate -
myAuthor
private java.lang.String myAuthor -
myContentsStatus
-
myPropertiesStatus
-
myRemoteContentsStatus
-
myRemoteNodeStatus
-
myRemotePropertiesStatus
-
myIsLocked
private boolean myIsLocked -
myIsCopied
private boolean myIsCopied -
myIsSwitched
private boolean myIsSwitched -
myIsFileExternal
private boolean myIsFileExternal -
myConflictNewFile
private java.io.File myConflictNewFile -
myConflictOldFile
private java.io.File myConflictOldFile -
myConflictWrkFile
private java.io.File myConflictWrkFile -
myPropRejectFile
private java.io.File myPropRejectFile -
myCopyFromURL
private java.lang.String myCopyFromURL -
myCopyFromRevision
-
myRemoteLock
-
myLocalLock
-
myEntryProperties
private java.util.Map myEntryProperties -
myRemoteRevision
-
myRemoteURL
-
myRemoteKind
-
myRemoteAuthor
private java.lang.String myRemoteAuthor -
myRemoteDate
private java.util.Date myRemoteDate -
myLocalContentsDate
private java.util.Date myLocalContentsDate -
myLocalPropertiesDate
private java.util.Date myLocalPropertiesDate -
myEntry
-
myChangelistName
private java.lang.String myChangelistName -
myWorkingCopyFormat
private int myWorkingCopyFormat -
myTreeConflict
-
myIsConflicted
private boolean myIsConflicted -
myNodeStatus
-
myRepositoryRootURL
-
myRepositoryUUID
private java.lang.String myRepositoryUUID -
myRepositoryRelativePath
private java.lang.String myRepositoryRelativePath -
myIsVersioned
private boolean myIsVersioned -
myDepth
-
myMovedToPath
private java.io.File myMovedToPath -
myMovedFromPath
private java.io.File myMovedFromPath
-
-
Constructor Details
-
SVNStatus
public SVNStatus(SVNURL url, java.io.File file, SVNNodeKind kind, SVNRevision revision, SVNRevision committedRevision, java.util.Date committedDate, java.lang.String author, SVNStatusType contentsStatus, SVNStatusType propertiesStatus, SVNStatusType remoteContentsStatus, SVNStatusType remotePropertiesStatus, boolean isLocked, boolean isCopied, boolean isSwitched, boolean isFileExternal, java.io.File conflictNewFile, java.io.File conflictOldFile, java.io.File conflictWrkFile, java.io.File projRejectFile, java.lang.String copyFromURL, SVNRevision copyFromRevision, SVNLock remoteLock, SVNLock localLock, java.util.Map entryProperties, java.lang.String changelistName, int wcFormatVersion, SVNTreeConflictDescription treeConflict) Constructs an SVNStatus object filling it with status information details.Used by SVNKit internals to construct and initialize an SVNStatus object. It's not intended for users (from an API point of view).
- Parameters:
url- item's repository locationfile- item's path in a File representationkind- item's node kindrevision- item's working revisioncommittedRevision- item's last changed revisioncommittedDate- item's last changed dateauthor- item's last commit authorcontentsStatus- local status of item's contentspropertiesStatus- local status of item's propertiesremoteContentsStatus- status of item's contents against a repositoryremotePropertiesStatus- status of item's properties against a repositoryisLocked- if the item is locked by the driver (not a user lock)isCopied- if the item is added with historyisSwitched- if the item is switched to a different URLisFileExternal- tells if the item is an external fileconflictNewFile- temp file with latest changes from the repositoryconflictOldFile- temp file just as the conflicting one was at the BASE revisionconflictWrkFile- temp file with all user's current local modificationsprojRejectFile- temp file describing properties conflictscopyFromURL- url of the item's ancestor from which the item was copiedcopyFromRevision- item's ancestor revision from which the item was copiedremoteLock- item's lock in the repositorylocalLock- item's local lockentryProperties- item's SVN specific '<entry' propertieschangelistName- changelist name which the item belongs towcFormatVersion- working copy format numbertreeConflict- tree conflict description- Since:
- 1.3
-
SVNStatus
public SVNStatus()
-
-
Method Details
-
getURL
Gets the item's repository location. URL is taken from theSVNProperty.URLproperty.- Returns:
- the item's URL represented as an SVNURL object
-
getRemoteURL
Gets the item's latest repository location. For example, the item could have been moved in the repository, butgetURL()returns the item's URL as it's defined in a URL entry property. Applicable for a remote status invocation. Used by SVNKit internals and not intended for users (from an API point of view). UsegetRepositoryRelativePathandgetRepositoryRootURL()instead.- Returns:
- the item's URL as it's real repository location
-
getFile
public java.io.File getFile()Gets the item's path in the filesystem.- Returns:
- a File representation of the item's path
-
getKind
Gets the item's node kind characterizing it as an entry.- Returns:
- the item's node kind (whether it's a file, directory, etc.)
-
getRevision
Gets the item's current working revision.- Returns:
- the item's working revision
-
getCommittedRevision
Gets the revision when the item was last changed (committed).- Returns:
- the last committed revision
-
getCommittedDate
public java.util.Date getCommittedDate()Gets the timestamp when the item was last changed (committed).- Returns:
- the last committed date
-
getAuthor
public java.lang.String getAuthor()Gets the author who last changed the item.- Returns:
- the item's last commit author
-
getContentsStatus
Gets the Working Copy local item's contents status type.- Returns:
- the local contents status type
-
getPropertiesStatus
Gets the Working Copy local item's properties status type.- Returns:
- the local properties status type
-
getRemoteContentsStatus
Gets the Working Copy item's contents status type against the repository - that is comparing the item's BASE revision and the latest one in the repository when the item was changed. Applicable for a remote status invocation.If the remote contents status type !=
SVNStatusType.STATUS_NONEthe local file may be out of date.- Returns:
- the remote contents status type
-
getRemotePropertiesStatus
Gets the Working Copy item's properties status type against the repository - that is comparing the item's BASE revision and the latest one in the repository when the item was changed. Applicable for a remote status invocation.If the remote properties status type !=
SVNStatusType.STATUS_NONEthe local file may be out of date.- Returns:
- the remote properties status type
-
isLocked
public boolean isLocked()Finds out if the item is locked (not a user lock but a driver's one when during an operation a Working Copy is locked in .svn administrative areas to prevent from other operations interrupting until the running one finishes).To clean up a Working Copy use
doCleanup().- Returns:
- true if locked, otherwise false
-
isCopied
public boolean isCopied()Finds out if the item is added with history.- Returns:
- true if the item is added with history, otherwise false
-
isSwitched
public boolean isSwitched()Finds out whether the item is switched to a different repository location.- Returns:
- true if switched, otherwise false
-
isFileExternal
public boolean isFileExternal()Tells if this is an externals file or not.- Returns:
- true if is a file external, otherwise false
- Since:
- 1.3
-
getConflictNewFile
public java.io.File getConflictNewFile()Gets the temporary file that contains all latest changes from the repository which led to a conflict with local changes. This file is at the HEAD revision.- Returns:
- an autogenerated temporary file just as it is in the latest revision in the repository
-
getConflictOldFile
public java.io.File getConflictOldFile()Gets the temporary BASE revision file of that working file that is currently in conflict with changes received from the repository. This file does not contain the latest user's modifications, only 'pristine' contents.- Returns:
- an autogenerated temporary file just as the conflicting file was before any modifications to it
-
getConflictWrkFile
public java.io.File getConflictWrkFile()Gets the temporary '.mine' file with all current local changes to the original file. That is if the file item is in conflict with changes that came during an update this temporary file is created to get the snapshot of the user's file with only the user's local modifications and nothing more.- Returns:
- an autogenerated temporary file with only the user's modifications
-
getPropRejectFile
public java.io.File getPropRejectFile()Gets the '.prej' file containing details on properties conflicts. If the item's properties are in conflict with those that came during an update this file will contain a conflict description.- Returns:
- the properties conflicts file
-
getCopyFromURL
public java.lang.String getCopyFromURL()Gets the URL (repository location) of the ancestor from which the item was copied. That is when the item is added with history.- Returns:
- the item ancestor's URL
-
getCopyFromRevision
Gets the revision of the item's ancestor from which the item was copied (the item is added with history).- Returns:
- the ancestor's revision
-
getRemoteLock
Gets the file item's repository lock - applicable for a remote status invocation.- Returns:
- file item's repository lock
-
getLocalLock
Gets the file item's local lock.- Returns:
- file item's local lock
-
getEntryProperties
public java.util.Map getEntryProperties()Gets the item's SVN specific '<entry' properties. These properties' names start withSVNProperty.SVN_ENTRY_PREFIX.- Returns:
- a Map which keys are names of SVN entry properties mapped against their values (both strings)
-
getRemoteRevision
Gets the item's last committed repository revision. Relevant for a remote status invocation.- Returns:
- the latest repository revision when the item was changed; SVNRevision.UNDEFINED if there are no incoming changes for this file or directory.
-
getRemoteKind
Returns the kind of the item got from the repository. Relevant for a remote status invocation.- Returns:
- a remote item kind
-
getRemoteDate
public java.util.Date getRemoteDate()Gets the item's last changed date. Relevant for a remote status invocation.- Returns:
- a repository last changed date
-
getRemoteAuthor
public java.lang.String getRemoteAuthor()Gets the item's last changed author. Relevant for a remote status invocation.- Returns:
- a last commit author
-
getWorkingContentsDate
public java.util.Date getWorkingContentsDate()Returns the last modified local time of the file item. Irrelevant for directories (for directories returnsDate(0)).- Returns:
- last modified time of the file
-
getWorkingPropertiesDate
public java.util.Date getWorkingPropertiesDate()Returns the last modified local time of file or directory properties.- Returns:
- last modified time of the item properties
-
markExternal
public void markExternal()Marks the item as an external. This method is used by SVNKit internals and not intended for users (from an API point of view). -
setRemoteStatus
public void setRemoteStatus(SVNStatusType contents, SVNStatusType props, SVNLock lock, SVNNodeKind kind) Sets the item's remote status. Used by SVNKit internals and not intended for users (from an API point of view).- Parameters:
contents- item's contents status type against the repositoryprops- item's properties status type against the repositorylock- item's lock in the repositorykind- item's node kind
-
setRemoteStatus
public void setRemoteStatus(SVNURL url, SVNStatusType contents, SVNStatusType props, SVNLock lock, SVNNodeKind kind, SVNRevision revision, java.util.Date date, java.lang.String author) Sets the item's remote status. Used by SVNKit internals and not intended for users (from an API point of view).- Parameters:
url- item's repository URLcontents- item's contents status type against the repositoryprops- item's properties status type against the repositorylock- item's lock in the repositorykind- item's node kindrevision- item's latest revision when it was last committeddate- last item's committed dateauthor- last item's committed author
-
setContentsStatus
Sets the item's contents status type. Used by SVNKit internals and not intended for users (from an API point of view).- Parameters:
statusType- status type of the item's contents
-
setEntry
Sets a WC entry for which this object is generated. Used in internals.- Parameters:
entry- a WC entry
-
getEntry
Returns a WC entry for which this object is generated.- Returns:
- a WC entry (if set)
-
getChangelistName
public java.lang.String getChangelistName()Returns the name of the changelist which the working copy item, denoted by this object, belongs to.- Returns:
- changelist name
- Since:
- 1.2
-
getTreeConflict
Returns a tree conflict description.- Returns:
- tree conflict description;
nullif no conflict description exists on this item - Since:
- 1.3
-
getWorkingCopyFormat
public int getWorkingCopyFormat()Returns the working copy format number for the admin directory which the statused item is versioned under. If this status object is a result of a remote status operation, the method will return-1.- Returns:
- working copy format number;
-1for remote status - Since:
- 1.2
-
setConflicted
public void setConflicted(boolean isConflicted) -
isConflicted
public boolean isConflicted() -
isVersioned
public boolean isVersioned() -
getRemoteNodeStatus
-
getCombinedNodeAndContentsStatus
-
getCombinedRemoteNodeAndContentsStatus
-
getNodeStatus
-
getRepositoryRootURL
-
getRepositoryUUID
public java.lang.String getRepositoryUUID() -
getRepositoryRelativePath
public java.lang.String getRepositoryRelativePath() -
getDepth
-
getMovedToPath
public java.io.File getMovedToPath() -
getMovedFromPath
public java.io.File getMovedFromPath() -
setRemoteNodeStatus
-
setNodeStatus
-
setRepositoryRootURL
-
setRepositoryUUID
public void setRepositoryUUID(java.lang.String repositoryUUID) -
setRepositoryRelativePath
public void setRepositoryRelativePath(java.lang.String repositoryRelativePath) -
setURL
-
setFile
public void setFile(java.io.File file) -
setKind
-
setRevision
-
setCommittedRevision
-
setCommittedDate
public void setCommittedDate(java.util.Date committedDate) -
setAuthor
public void setAuthor(java.lang.String author) -
setPropertiesStatus
-
setRemoteContentsStatus
-
setRemotePropertiesStatus
-
setIsLocked
public void setIsLocked(boolean isLocked) -
setIsCopied
public void setIsCopied(boolean isCopied) -
setIsSwitched
public void setIsSwitched(boolean isSwitched) -
setIsFileExternal
public void setIsFileExternal(boolean isFileExternal) -
setConflictNewFile
public void setConflictNewFile(java.io.File conflictNewFile) -
setConflictOldFile
public void setConflictOldFile(java.io.File conflictOldFile) -
setConflictWrkFile
public void setConflictWrkFile(java.io.File conflictWrkFile) -
setPropRejectFile
public void setPropRejectFile(java.io.File propRejectFile) -
setCopyFromURL
public void setCopyFromURL(java.lang.String copyFromURL) -
setCopyFromRevision
-
setRemoteLock
-
setLocalLock
-
setEntryProperties
public void setEntryProperties(java.util.Map entryProperties) -
setRemoteRevision
-
setRemoteURL
-
setRemoteKind
-
setRemoteAuthor
public void setRemoteAuthor(java.lang.String remoteAuthor) -
setRemoteDate
public void setRemoteDate(java.util.Date remoteDate) -
setLocalContentsDate
public void setLocalContentsDate(java.util.Date localContentsDate) -
setLocalPropertiesDate
public void setLocalPropertiesDate(java.util.Date localPropertiesDate) -
setChangelistName
public void setChangelistName(java.lang.String changelistName) -
setWorkingCopyFormat
public void setWorkingCopyFormat(int workingCopyFormat) -
setTreeConflict
-
setIsConflicted
public void setIsConflicted(boolean isConflicted) -
setIsVersioned
public void setIsVersioned(boolean isVersioned) -
setDepth
-
setMovedFromPath
public void setMovedFromPath(java.io.File path) -
setMovedToPath
public void setMovedToPath(java.io.File path) -
combineNodeAndContentsStatus
public static SVNStatusType combineNodeAndContentsStatus(int workingCopyFormat, SVNStatusType nodeStatus, SVNStatusType contentsStatus, boolean versioned, boolean conflicted) -
combineRemoteNodeAndContentsStatus
public static SVNStatusType combineRemoteNodeAndContentsStatus(int workingCopyFormat, SVNStatusType remoteNodeStatus, SVNStatusType remoteContentsStatus)
-