The
SVNStatus class is used to provide detailed status information for
a Working Copy item as a result of a status operation invoked by a
doStatus() method of
SVNStatusClient.
SVNStatus objects are
generated for each 'interesting' local item and depending on the doStatus() method
in use either passed for notification to an
ISVNStatusHandler
implementation or such an object is just returned by the method as a
status info for a single item.
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) {
if(status.getContentsStatus() == SVNStatusType.STATUS_MODIFIED) {
...
} else if(status.getContentsStatus() == SVNStatusType.STATUS_CONFLICTED) {
...
}
...
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);
...
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.
SVNStatus
public SVNStatus(SVNURL url,
File file,
SVNNodeKind kind,
SVNRevision revision,
SVNRevision committedRevision,
Date committedDate,
String author,
SVNStatusType contentsStatus,
SVNStatusType propertiesStatus,
SVNStatusType remoteContentsStatus,
SVNStatusType remotePropertiesStatus,
boolean isLocked,
boolean isCopied,
boolean isSwitched,
File conflictNewFile,
File conflictOldFile,
File conflictWrkFile,
File projRejectFile,
String copyFromURL,
SVNRevision copyFromRevision,
SVNLock remoteLock,
SVNLock localLock,
Map entryProperties) 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).
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 URLconflictNewFile - 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' properties
getAuthor
public String getAuthor()
Gets the author who last changed the item.
- the item's last commit author
getCommittedDate
public Date getCommittedDate()
Gets the timestamp when the item was last changed (committed).
getCommittedRevision
public SVNRevision getCommittedRevision()
Gets the revision when the item was last changed (committed).
- the last committed revision
getConflictNewFile
public 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.
- an autogenerated temporary file just as it is in the latest
revision in the repository
getConflictOldFile
public 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.
- an autogenerated temporary file just as the conflicting file was
before any modifications to it
getConflictWrkFile
public 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.
- an autogenerated temporary file with only the user's modifications
getContentsStatus
public SVNStatusType getContentsStatus()
Gets the Working Copy local item's contents status type.
- the local contents status type
getCopyFromRevision
public SVNRevision getCopyFromRevision()
Gets the revision of the item's ancestor
from which the item was copied (the item is added
with history).
getCopyFromURL
public 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.
getEntry
public org.tmatesoft.svn.core.internal.wc.admin.SVNEntry getEntry()
Returns a WC entry for which this object is generated.
getEntryProperties
public Map getEntryProperties()
- a Map which keys are names of SVN entry properties mapped
against their values (both strings)
getFile
public File getFile()
Gets the item's path in the filesystem.
- a File representation of the item's path
getKind
public SVNNodeKind getKind()
Gets the item's node kind characterizing it as an entry.
- the item's node kind (whether it's a file, directory, etc.)
getLocalLock
public SVNLock getLocalLock()
Gets the file item's local lock.
getPropRejectFile
public 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.
- the properties conflicts file
getPropertiesStatus
public SVNStatusType getPropertiesStatus()
Gets the Working Copy local item's properties status type.
- the local properties status type
getRemoteAuthor
public String getRemoteAuthor()
Gets the item's last changed author. Relevant for a
remote status invocation.
getRemoteContentsStatus
public SVNStatusType 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_NONE
the local file may be out of date.
- the remote contents status type
getRemoteDate
public Date getRemoteDate()
Gets the item's last changed date. Relevant for a
remote status invocation.
- a repository last changed date
getRemoteKind
public SVNNodeKind getRemoteKind()
Returns the kind of the item got from the repository. Relevant for a
remote status invocation.
getRemoteLock
public SVNLock getRemoteLock()
Gets the file item's repository lock -
applicable for a remote status invocation.
- file item's repository lock
getRemotePropertiesStatus
public SVNStatusType 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_NONE
the local file may be out of date.
- the remote properties status type
getRemoteRevision
public SVNRevision getRemoteRevision()
Gets the item's last committed repository revision. Relevant for a
remote status invocation.
- the latest repository revision when the item was changed;
null or
SVNRevision.UNDEFINED if the repository revision is
unavailable
getRemoteURL
public SVNURL getRemoteURL()
Gets the item's latest repository location.
For example, the item could have been moved in the repository,
but
getURL() returns the item's
URL as it's defined in a URL entry property. Applicable
for a remote status invocation.
- the item's URL as it's real repository location
getRevision
public SVNRevision getRevision()
Gets the item's current working revision.
- the item's working revision
getURL
public SVNURL getURL()
Gets the item's repository location. URL is taken from the
SVNProperty.URL property.
- the item's URL represented as an SVNURL object
getWorkingContentsDate
public Date getWorkingContentsDate()
Returns the last modified local time of the file item.
Irrelevant for directories (for directories returns Date(0)).
- last modified time of the file
getWorkingPropertiesDate
public Date getWorkingPropertiesDate()
Returns the last modified local time of file or directory
properties.
- last modified time of the item properties
isCopied
public boolean isCopied()
Finds out if the item is added with history.
- true if the item
is added with history, otherwise false
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().
- true if locked, otherwise
false
isSwitched
public boolean isSwitched()
Finds out whether the item is switched to a different
repository location.
- true if switched, otherwise
false
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).
setContentsStatus
public void setContentsStatus(SVNStatusType statusType)
Sets the item's contents status type. Used by SVNKit internals and not
intended for users (from an API point of view).
statusType - status type of the item's contents
setEntry
public void setEntry(org.tmatesoft.svn.core.internal.wc.admin.SVNEntry entry)
Sets a WC entry for which this object is generated.
Used in internals.
setRemoteStatus
public void setRemoteStatus(SVNURL url,
SVNStatusType contents,
SVNStatusType props,
SVNLock lock,
SVNNodeKind kind,
SVNRevision revision,
Date date,
String author) Sets the item's remote status. Used by SVNKit internals and not
intended for users (from an API point of view).
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
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).
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