Locks path(s) at definite revision(s).
Note that locking is never anonymous, so any server implementing this function will have to "pull" a username from the client, if it hasn't done so already.
Each path to be locked is handled with the provided handler
. If a path was successfully locked, the handler
's {@link ISVNLockHandler#handleLock(String,SVNLock,SVNErrorMessage) handleLock()}is called that receives the path and either a lock object (representing the lock that was set on the path) or an error exception, if locking failed for that path.
If any path is already locked by a different user and the force
flag is false, then this call fails with throwing an SVNException. But if force
is true, then the existing lock(s) will be "stolen" anyway, even if the user name does not match the current lock's owner.
Paths can be both relative to the location of this driver and absolute to the repository root (starting with "/"
).
@param pathsToRevisions a map which keys are paths and values are revision numbers (as Longs); paths are strings and revision numbers are Long objects
@param comment a comment string for the lock (optional)
@param force true if the file is to be locked in any way (even if it's already locked by someone else)
@param handler if not null, the lockhandler is invoked on each path to be locked
@throws SVNException in the following cases:
force
is false and a path is already locked by someone else - a revision of a path is less than its last changed revision
- a path does not exist in the latest revision
- a failure occured while connecting to a repository
- the user authentication failed (see {@link org.tmatesoft.svn.core.SVNAuthenticationException})
@see #unlock(Map,boolean,ISVNLockHandler)
@see #getLocks(String)
@see #getLock(String)
@see org.tmatesoft.svn.core.SVNLock
@since SVN 1.2