if(pathsToRevisions == null || pathsToRevisions.isEmpty()){ return; }  Iterator keyIter = pathsToRevisions.keySet().iterator(); while(keyIter.hasNext()){ String keyPath = (String)keyIter.next(); Long revVal = (Long)pathsToRevisions.get(keyPath); String absLockPath = SVNPathUtil.canonicalizeAbsPath(keyPath); SVNLock lockToBeMade = new SVNLock(absLockPath, FSRepositoryUtil.generateLockToken(), getUserName(), comment, new Date(System.currentTimeMillis()), null); FSWriter.doLock(lockToBeMade, myReposRootDir, myRevNodesPool, force, revVal.longValue()); if(handler != null){ handler.handleLock(keyPath, lockToBeMade, null); }
try{ openRepository(); for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String)paths.next(); Long revision = (Long)pathsToRevisions.get(path); String reposPath = getRepositoryPath(path); long curRevision = (revision == null || isInvalidRevision(revision.longValue())) ? FSReader.getYoungestRevision(myReposRootDir) : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try{ lock = FSWriter.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, this, myReposRootDir); }catch(SVNException svne){ error = svne.getErrorMessage(); if(!FSErrors.isLockError(error)){ throw svne; } } if(handler != null){ handler.handleLock(reposPath, lock, error); } } }finally{ closeRepository();
    public void lock(Map pathsToRevisions, String comment, boolean force, ISVNLockHandler handler) throws SVNException {        if(pathsToRevisions == null || pathsToRevisions.isEmpty()){            return;        }                /*The cycle below is used to find each path came to function*/        Iterator keyIter = pathsToRevisions.keySet().iterator();        while(keyIter.hasNext()){            String keyPath = (String)keyIter.next();            Long revVal = (Long)pathsToRevisions.get(keyPath);            String absLockPath = SVNPathUtil.canonicalizeAbsPath(keyPath);            SVNLock lockToBeMade = new SVNLock(absLockPath, /*ID*/FSRepositoryUtil.generateLockToken(), /*owner*/getUserName(), comment, new Date(System.currentTimeMillis()), null/*expiration Date*/);            FSWriter.doLock(lockToBeMade, myReposRootDir, myRevNodesPool, force, revVal.longValue());            if(handler != null){                handler.handleLock(keyPath, lockToBeMade, null);            }                    }    }   