Class RemoteSession
- All Implemented Interfaces:
ISVNRemote
public class RemoteSession extends JNIObject implements ISVNRemote
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.subversion.javahl.ISVNRemote
ISVNRemote.Capability, ISVNRemote.FileRevision, ISVNRemote.LocationSegment -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedRemoteSession(long cppAddr)This constructor is called from JNI to get an instance. -
Method Summary
Modifier and Type Method Description voidcancelOperation()Cancel the active operation, including any ongoing edits.voidchangeRevisionProperty(long revision, String propertyName, byte[] oldValue, byte[] newValue)Change the value of an unversioned property.NodeKindcheckPath(String path, long revision)Return the kind of the node inpathatrevision.voiddispose()Release the native peer (should not depend on finalize).voidfinalize()ISVNEditorgetCommitEditor(Map<String,byte[]> revisionProperties, CommitCallback commitCallback, Set<Lock> lockTokens, boolean keepLocks)Like {@link #getCommitEditor(Map,CommitCallbacknull. ISVNEditorgetCommitEditor(Map<String,byte[]> revisionProperties, CommitCallback commitCallback, Set<Lock> lockTokens, boolean keepLocks, ISVNEditor.ProvideBaseCallback getBase, ISVNEditor.ProvidePropsCallback getProps, ISVNEditor.GetNodeKindCallback getCopyfromKind)Return an editor for committing changes to the session's repository, setting the revision properties fromrevisionProperties.longgetDirectory(long revision, String path, int direntFields, Map<String,DirEntry> dirents, Map<String,byte[]> properties)Fetch the contents and properties of directorypathatrevision.longgetFile(long revision, String path, OutputStream contents, Map<String,byte[]> properties)Fetch the contents and properties of filepathatrevision.List<ISVNRemote.FileRevision>getFileRevisions(String path, long startRevision, long endRevision, boolean includeMergedRevisions)Retrieve a subset of the interesting revisions of a filepathas seen in revisionendRevision.voidgetFileRevisions(String path, long startRevision, long endRevision, boolean includeMergedRevisions, RemoteFileRevisionsCallback handler)Callhandlerfor each of a subset of the interesting revisions of a filepathas seen in revisionendRevision.longgetLatestRevision()Get the latest revision number from the session's repository.Map<Long,String>getLocations(String path, long pegRevision, Iterable<Long> locationRevisions)Find the locations of the object identified bypathandpegRevisionin the repository at the given revisions.List<ISVNRemote.LocationSegment>getLocationSegments(String path, long pegRevision, long startRevision, long endRevision)Return a list of segments in the location history ofpathatpegRevision, working backwards in time fromstartRevisiontoendRevision.voidgetLocationSegments(String path, long pegRevision, long startRevision, long endRevision, RemoteLocationSegmentsCallback handler)Callhandlerfor every segment in the location history ofpathatpegRevision, working backwards in time fromstartRevisiontoendRevision.Map<String,Lock>getLocks(String path, Depth depth)Return a dictionary containing all locks on or below the given path.voidgetLog(Iterable<String> paths, long startRevision, long endRevision, int limit, boolean strictNodeHistory, boolean discoverPath, boolean includeMergedRevisions, Iterable<String> revisionProperties, LogMessageCallback callback)Invokecallbackfor each log message fromstartRevisiontoendRevision.Map<String,Mergeinfo>getMergeinfo(Iterable<String> paths, long revision, Mergeinfo.Inheritance inherit, boolean includeDescendants)Retrieve the merginfo forpaths, whose elements are relative to the session's URL.StringgetReposRelativePath(String url)Return a path relative to the repository root URL associated with current session URL.StringgetReposRootUrl()Get the root URL of the session's repository.StringgetReposUUID()Get the UUID of the session's repository.longgetRevisionByDate(Date date)Get the latest revision number at the given time from the session's repository.longgetRevisionByTimestamp(long timestamp)Get the latest revision number at the given time, expressed as the number of microseconds since the epoch, from the session's repository.Map<String,byte[]>getRevisionProperties(long revision)Return the set of unversioned properties set onrevisionin the session's repository.byte[]getRevisionProperty(long revision, String propertyName)Return the value of unversioned propertypropertyNameinrevisionin the session's repository.StringgetSessionRelativePath(String url)Return a path relative to the current session URL.StringgetSessionUrl()Get the current session URL.booleanhasCapability(ISVNRemote.Capability capability)Check if the server associated with this session has the givencapability.voidreparent(String url)Change the URL of the session to point to a new path in the same repository.DirEntrystat(String path, long revision)Return the directory entry object forpathatrevision.ISVNReporterstatus(String statusTarget, long revision, Depth depth, RemoteStatus receiver)Ask for a description of the status of a working copy with respect torevisionof the session's repository, or the HEAD revision ifrevisionisRevision.SVN_INVALID_REVNUM.
-
Constructor Details
-
RemoteSession
protected RemoteSession(long cppAddr)This constructor is called from JNI to get an instance.
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:ISVNRemoteRelease the native peer (should not depend on finalize). Also invalidates any existing editors related to this session.- Specified by:
disposein interfaceISVNRemote
-
cancelOperation
Description copied from interface:ISVNRemoteCancel the active operation, including any ongoing edits.- Specified by:
cancelOperationin interfaceISVNRemote- Throws:
ClientException
-
reparent
Description copied from interface:ISVNRemoteChange the URL of the session to point to a new path in the same repository.Note: The operation fails if the URL has a different repository root than the current session URL.
- Specified by:
reparentin interfaceISVNRemote- Throws:
ClientException
-
getSessionUrl
Description copied from interface:ISVNRemoteGet the current session URL.- Specified by:
getSessionUrlin interfaceISVNRemote- Throws:
ClientException
-
getSessionRelativePath
Description copied from interface:ISVNRemoteReturn a path relative to the current session URL.- Specified by:
getSessionRelativePathin interfaceISVNRemote- Parameters:
url- Must be a child of the current session URL.- Throws:
ClientException
-
getReposRelativePath
Description copied from interface:ISVNRemoteReturn a path relative to the repository root URL associated with current session URL.- Specified by:
getReposRelativePathin interfaceISVNRemote- Parameters:
url- Must be a child of the repository root URL.- Throws:
ClientException
-
getReposUUID
Description copied from interface:ISVNRemoteGet the UUID of the session's repository.- Specified by:
getReposUUIDin interfaceISVNRemote- Throws:
ClientException
-
getReposRootUrl
Description copied from interface:ISVNRemoteGet the root URL of the session's repository.- Specified by:
getReposRootUrlin interfaceISVNRemote- Throws:
ClientException
-
getLatestRevision
Description copied from interface:ISVNRemoteGet the latest revision number from the session's repository.- Specified by:
getLatestRevisionin interfaceISVNRemote- Throws:
ClientException
-
getRevisionByDate
Description copied from interface:ISVNRemoteGet the latest revision number at the given time from the session's repository.- Specified by:
getRevisionByDatein interfaceISVNRemote- Throws:
ClientException
-
getRevisionByTimestamp
Description copied from interface:ISVNRemoteGet the latest revision number at the given time, expressed as the number of microseconds since the epoch, from the session's repository.- Specified by:
getRevisionByTimestampin interfaceISVNRemote- Throws:
ClientException
-
changeRevisionProperty
public void changeRevisionProperty(long revision, String propertyName, byte[] oldValue, byte[] newValue) throws ClientExceptionDescription copied from interface:ISVNRemoteChange the value of an unversioned property.Note: If the server has Capability.atomic_revprops and
oldValueis notnull, and the present value of the propery is notoldValue(e.g., if another client changed the property), then the operation will fail.Note: If the server does not adveritse Capability.atomic_revprops, then
oldValuemust benull.- Specified by:
changeRevisionPropertyin interfaceISVNRemote- Parameters:
revision- The revision to which the propery is attachedpropertyName- The name of the properyoldValue- The previous value of the property (see note below)newValue- The new value of the property. IfnewValueisnull, the property will be deleted.- Throws:
ClientException
-
getRevisionProperties
Description copied from interface:ISVNRemoteReturn the set of unversioned properties set onrevisionin the session's repository.- Specified by:
getRevisionPropertiesin interfaceISVNRemote- Throws:
ClientException
-
getRevisionProperty
Description copied from interface:ISVNRemoteReturn the value of unversioned propertypropertyNameinrevisionin the session's repository. Returnsnullif the property does not exist.- Specified by:
getRevisionPropertyin interfaceISVNRemote- Throws:
ClientException
-
getCommitEditor
public ISVNEditor getCommitEditor(Map<String,byte[]> revisionProperties, CommitCallback commitCallback, Set<Lock> lockTokens, boolean keepLocks, ISVNEditor.ProvideBaseCallback getBase, ISVNEditor.ProvidePropsCallback getProps, ISVNEditor.GetNodeKindCallback getCopyfromKind) throws ClientExceptionDescription copied from interface:ISVNRemoteReturn an editor for committing changes to the session's repository, setting the revision properties fromrevisionProperties. The revisions being committed against are passed to the editor functions. The root of the commit is the session's URL.revisionPropertiesis a hash mapping property names to property values. The commit log message is expected to be in theProperty.REV_LOGelement.revisionPropertiescan not contain either ofProperty.REV_DATEorProperty.REV_AUTHOR.Before
ISVNEditor.complete()returns, but after the commit has succeeded, it will invokecommitCallback(if notnull) with filled-inCommitInfo. IfcommitCallbackreturns an error, that error will be returned fromISVNEditor.complete(), otherwiseISVNEditor.complete()will return successfully (unless it encountered an error before invokingcommitCallback). The callback will not be called if the commit was a no-op (i.e., nothing was committed).lockTokens, if notnull, is a hash mapping paths (relative to the session's URL) to lock tokens. The server checks that the correct token is provided for each committed, locked path.lockTokensmust live during the whole commit operation.If
keepLocks is true, then do not release locks on committed objects. Else, automatically release such locks. The callbacks
getBase,getPropsandgetCopyfromKindare invoked by the editor to fetch the contents, preoprties and copyfrom kind of an entry during the commit drive. They may benull; in that case, the commit may be less efficient because the client will not be able to delta-compress the data sent to the server, and more server connections may have to be opened.The caller may not perform any remote operations using this session before finishing the edit.
- Specified by:
getCommitEditorin interfaceISVNRemote- Throws:
ClientException
-
getCommitEditor
public ISVNEditor getCommitEditor(Map<String,byte[]> revisionProperties, CommitCallback commitCallback, Set<Lock> lockTokens, boolean keepLocks) throws ClientExceptionDescription copied from interface:ISVNRemoteLike {@link #getCommitEditor(Map,CommitCallbacknull. - Specified by:
getCommitEditorin interfaceISVNRemote- Throws:
ClientException
-
getFile
public long getFile(long revision, String path, OutputStream contents, Map<String,byte[]> properties) throws ClientExceptionDescription copied from interface:ISVNRemoteFetch the contents and properties of filepathatrevision.revisionmay beRevision.SVN_INVALID_REVNUMindicating that the HEAD revision should be used.pathis interpreted relative to the session's URL.If
revisionisRevision.SVN_INVALID_REVNUM. returns the actual revision that was retrieved; otherwise returnsrevision.If
contentsis notnull, push the contents of the file into the stream.If
propertiesis notnull, setpropertiesto contain the properties of the file. This means all properties: not just ones controlled by the user and stored in the repository, but immutable ones generated by the SCM system itself (e.g. 'wcprops', 'entryprops', etc.). Any existing contents of thepropertiesmap will be discarded by callingMap.clear(), if the map implementation supports that operation.The implementations of
contentsandpropertiesmay not perform any ISVNRemote operations using this session.- Specified by:
getFilein interfaceISVNRemote- Returns:
- The revision of the file that was retrieved.
- Throws:
ClientException
-
getDirectory
public long getDirectory(long revision, String path, int direntFields, Map<String,DirEntry> dirents, Map<String,byte[]> properties) throws ClientExceptionDescription copied from interface:ISVNRemoteFetch the contents and properties of directorypathatrevision.revisionmay beRevision.SVN_INVALID_REVNUM, indicating that the HEAD revision should be used.pathis interpreted relative to the session's URL.If
direntsis notnull, it will contain all the entries of the directory; the keys will be the entry basenames. Any existing contente of thedirentscollection will be discarded by callingMap.clear(), if the collection implementation supports that operation.direntFieldscontrols which portions of the DirEntry objects are filled in. To have them completely filled in, just pass DirEntry.Fields.all, othewise pass a bitwise OR of any of the DirEntry.Fields flags you would like to have.If
propertiesis notnull, setpropertiesto contain the properties of the directory. This means all properties: not just ones controlled by the user and stored in the repository, but immutable ones generated by the SCM system itself (e.g. 'wcprops', 'entryprops', etc.). Any existing contents of thepropertiesmap will be discarded by callingMap.clear(), if the map implementation supports that operation.The implementations of
direntsandpropertiesmay not perform any ISVNRemote operations using this session.- Specified by:
getDirectoryin interfaceISVNRemote- Returns:
- The revision of the directory that was retrieved.
- Throws:
ClientException
-
getMergeinfo
public Map<String,Mergeinfo> getMergeinfo(Iterable<String> paths, long revision, Mergeinfo.Inheritance inherit, boolean includeDescendants) throws ClientExceptionDescription copied from interface:ISVNRemoteRetrieve the merginfo forpaths, whose elements are relative to the session's URL. The request will fail if any one ofpathsdoes not exist in the givenrevision.Note: If the server doesn't support retrieval of mergeinfo (which can happen even for file:// URLs, if the repository itself hasn't been upgraded), an unsupported feature exception is thrown in preference to any other error that might otherwise be returned.
- Specified by:
getMergeinfoin interfaceISVNRemoterevision- The revision to look forpathsin. Defaults to the youngest revision whenRevision.SVN_INVALID_REVNUM.inherit- Indicates whether explicit, explicit or inherited, or only inherited mergeinfo forpathsis retrieved.includeDescendants- Whentrue, additionally return the mergeinfo for any descendant of any element ofpathswhich has the mergeinfo explicitly set on it. (Note that inheritance is only taken into account for the elements inpaths; descendants of the elements inpathswhich get their mergeinfo via inheritance are not included.)- Returns:
- A dictionary of
Mergeinfoobjects for the givenpaths, ornullif no mergeinfo is available.. - Throws:
ClientException
-
status
public ISVNReporter status(String statusTarget, long revision, Depth depth, RemoteStatus receiver) throws ClientExceptionDescription copied from interface:ISVNRemoteAsk for a description of the status of a working copy with respect torevisionof the session's repository, or the HEAD revision ifrevisionisRevision.SVN_INVALID_REVNUM.The client begins by providing a
receiverto the remote session; this object must contain knowledge of where the change will begin in the working copy.In return, the client receives an
ISVNReporterinstance, which it uses to describe its working copy by making calls to its methods.When finished, the client calls
ISVNReporter.finishReport(). This results inreceiverbeing called once for every path in the working copy that is different from the repository.statusTargetis an optional single path component that restricts the scope of the status report to an entry in the directory represented by the session's URL, or empty if the entire directory is meant to be examined.Get status as deeply as
depthindicates. IfdepthisDepth.unknown, get the status down to the ambient depth of the working copy. Ifdepthis deeper than the working copy, include changes that would be needed to populate the working copy to that depth.The caller may not perform any operations using this session before finishing the report, and may not perform any operations using this session from within the implementation of
receiver.Note: The reporter provided by this function does not supply copy-from information to the editor methods.
Note: In order to prevent pre-1.5 servers from doing more work than needed, and sending too much data back, a pre-1.5 'recurse' directive may be sent to the server, based on
depth.- Specified by:
statusin interfaceISVNRemote- Throws:
ClientException
-
getLog
public void getLog(Iterable<String> paths, long startRevision, long endRevision, int limit, boolean strictNodeHistory, boolean discoverPath, boolean includeMergedRevisions, Iterable<String> revisionProperties, LogMessageCallback callback) throws ClientExceptionDescription copied from interface:ISVNRemoteInvokecallbackfor each log message fromstartRevisiontoendRevision.startRevisionmay be greater or less thanendRevision; this just controls whether the log messages are processed in descending or ascending revision number order.If
startRevisionorendRevisionisRevision.SVN_INVALID_REVNUM, the HEAD revision is uses for that argument. If eiter is an invaild non-existent revision, an error will be returned.If
pathsis notnulland has one or more elements, then only show revisions in which at least one ofpathswas changed (i.e., if file, text or props changed; if dir, props changed or an entry was added or deleted).If
limitis non-zero only invoke @a receiver on the first code>limit logs.If
discoverPathis set, then each call tocallbackcontains the list of changed paths in that revision.If
strictNodeHistoryis set, copy history will not be traversed (if any exists) when harvesting the revision logs for each path.If
includeMergedRevisionsis set, log information for revisions which have been merged to @a targets will also be returned.If
revisionPropertiesisnull, retrieve all revision properties; otherwise, retrieve only the revision properties contained in the set (i.e. retrieve none if the set is empty).The implementation of
callbackmay not perform any operations using this session. If the invocation ofcallbackthrows an exception, the operation will stop.Note: If
pathsisnullor empty, the result depends on the server. Pre-1.5 servers will send nothing; 1.5 servers will effectively perform the log operation on the root of the repository. This behavior may be changed in the future to ensure consistency across all pedigrees of server.Note: Pre-1.5 servers do not support custom revprop retrieval;
revisionPropertiesisnullor contains a revprop other than svn:author, svn:date, or svn:log, an not-implemented error is returned.- Specified by:
getLogin interfaceISVNRemote- Throws:
ClientException
-
checkPath
Description copied from interface:ISVNRemoteReturn the kind of the node inpathatrevision.- Specified by:
checkPathin interfaceISVNRemote- Parameters:
path- A path relative to the sessionn URL- Throws:
ClientException
-
stat
Description copied from interface:ISVNRemoteReturn the directory entry object forpathatrevision.- Specified by:
statin interfaceISVNRemote- Parameters:
path- A path relative to the sessionn URL- Returns:
- A directory entry obeject, or
nullifpathatrevisiondoes not exist. - Throws:
ClientException
-
getLocations
public Map<Long,String> getLocations(String path, long pegRevision, Iterable<Long> locationRevisions) throws ClientExceptionDescription copied from interface:ISVNRemoteFind the locations of the object identified bypathandpegRevisionin the repository at the given revisions. If the object does not exist in a given revision, that revision will be ignored.Note: None of the parameters may be NULL.
- Specified by:
getLocationsin interfaceISVNRemote- Parameters:
path- A path relative to the session URLpegRevision- The peg revision to use for locating the objectlocationRevisions- The set of revisions to find locations for- Throws:
ClientException
-
getLocationSegments
public void getLocationSegments(String path, long pegRevision, long startRevision, long endRevision, RemoteLocationSegmentsCallback handler) throws ClientExceptionDescription copied from interface:ISVNRemoteCallhandlerfor every segment in the location history ofpathatpegRevision, working backwards in time fromstartRevisiontoendRevision.- Specified by:
getLocationSegmentsin interfaceISVNRemote- Parameters:
path- A session-relative path.pegRevision- The peg revision to findpathin.startRevision- The upper bound of the revision range. UseRevision.SVN_INVALID_REVNUMto indicate HEAD.endRevision- The lower bound of the revision range. UseRevision.SVN_INVALID_REVNUMto trace the history of the object to its origin.handler- The callback handler.- Throws:
ClientException
-
getLocationSegments
public List<ISVNRemote.LocationSegment> getLocationSegments(String path, long pegRevision, long startRevision, long endRevision) throws ClientExceptionDescription copied from interface:ISVNRemoteReturn a list of segments in the location history ofpathatpegRevision, working backwards in time fromstartRevisiontoendRevision.- Specified by:
getLocationSegmentsin interfaceISVNRemote- Parameters:
path- A session-relative path.pegRevision- The peg revision to findpathin.startRevision- The upper bound of the revision range. UseRevision.SVN_INVALID_REVNUMto indicate HEAD.endRevision- The lower bound of the revision range. UseRevision.SVN_INVALID_REVNUMto trace the history of the object to its origin.- Throws:
ClientException
-
getFileRevisions
public void getFileRevisions(String path, long startRevision, long endRevision, boolean includeMergedRevisions, RemoteFileRevisionsCallback handler) throws ClientExceptionDescription copied from interface:ISVNRemoteCallhandlerfor each of a subset of the interesting revisions of a filepathas seen in revisionendRevision.If there is an interesting revision of the file that is less than or equal to
startRevision, the iteration will begin at that revision. Otherwise the iteration will begin at the first revision of the file in the repository, which has to be less than or equal toendRevision. Note that if the function succeeds,handlerwill be called at least once.Note: This functionality is not available in pre-1.1 servers. If the server doesn't implement it, an alternative (but much slower) implementation based on
ISVNRemote.getLog(java.lang.Iterable<java.lang.String>, long, long, int, boolean, boolean, boolean, java.lang.Iterable<java.lang.String>, org.apache.subversion.javahl.callback.LogMessageCallback)is used.Note: With Subversion 1.8 and newer servers this function supports reversion of the revision range for when
includeMergedRevisionsisfalse.- Specified by:
getFileRevisionsin interfaceISVNRemote- Parameters:
path- A path relative to the session URL.startRevision- The lower bound of the revision interval.endRevision- the upper bound of the revision interval.includeMergedRevisions- Whentrue, revisions that contributed to a merge are included in the result.- Throws:
ClientException
-
getFileRevisions
public List<ISVNRemote.FileRevision> getFileRevisions(String path, long startRevision, long endRevision, boolean includeMergedRevisions) throws ClientExceptionDescription copied from interface:ISVNRemoteRetrieve a subset of the interesting revisions of a filepathas seen in revisionendRevision.If there is an interesting revision of the file that is less than or equal to
startRevision, the iteration will begin at that revision. Otherwise the iteration will begin at the first revision of the file in the repository, which has to be less than or equal toendRevision. Note that if the function succeeds, the returned list will contain at least one element.Note: This functionality is not available in pre-1.1 servers. If the server doesn't implement it, an alternative (but much slower) implementation based on
ISVNRemote.getLog(java.lang.Iterable<java.lang.String>, long, long, int, boolean, boolean, boolean, java.lang.Iterable<java.lang.String>, org.apache.subversion.javahl.callback.LogMessageCallback)is used.Note: With Subversion 1.8 and newer servers this function supports reversion of the revision range for when
includeMergedRevisionsisfalse.- Specified by:
getFileRevisionsin interfaceISVNRemote- Parameters:
path- A path relative to the session URL.startRevision- The lower bound of the revision interval.endRevision- the upper bound of the revision interval.includeMergedRevisions- Whentrue, revisions that contributed to a merge are included in the result.- Throws:
ClientException
-
getLocks
Description copied from interface:ISVNRemoteReturn a dictionary containing all locks on or below the given path.Note: It is not considered an error if
pathdoes not exist in HEAD. Such a search will simply return no locks.Note:This functionality is not available in pre-1.2 servers.
- Specified by:
getLocksin interfaceISVNRemote- Parameters:
path- A path relative to the sessionn URLdepth- The recursion depth- Throws:
ClientException
-
hasCapability
Description copied from interface:ISVNRemoteCheck if the server associated with this session has the givencapability.- Specified by:
hasCapabilityin interfaceISVNRemote- Throws:
ClientException
-
finalize
-