public void walkDigestFiles(File digestFile, ISVNLockHandler getLocksHandler, boolean haveWriteLock) throws SVNException { Collection children = new LinkedList(); SVNLock lock = fetchLockFromDigestFile(digestFile, null, children); if (lock != null) { Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() == null || current.compareTo(lock.getExpirationDate()) < 0) { getLocksHandler.handleLock(null, lock, null); } else if (haveWriteLock) { deleteLock(lock); } } if (children.isEmpty()) { return; } for (Iterator entries = children.iterator(); entries.hasNext();) { String digestName = (String) entries.next(); File parent = new File(myLocksRoot, digestName.substring(0, FSFS.DIGEST_SUBDIR_LEN)); File childDigestFile = new File(parent, digestName); walkDigestFiles(childDigestFile, getLocksHandler, haveWriteLock); } }
public void unlock(Map pathToTokens, boolean force, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathToTokens.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); String token = (String) pathToTokens.get(path); String reposPath = getRepositoryPath(path); SVNErrorMessage error = null; try { myFSFS.unlockPath(reposPath, token, getUserName(), force, true); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isUnlockError(error)) { throw svne; } } if (handler != null) { handler.handleUnlock(reposPath, new SVNLock(reposPath, token, null, null, null, null), error); } } } finally { closeRepository(); } }
public void walkDigestFiles(File digestFile, ISVNLockHandler getLocksHandler, boolean haveWriteLock) throws SVNException { Collection children = new LinkedList(); SVNLock lock = fetchLockFromDigestFile(digestFile, null, children); if (lock != null) { Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() == null || current.compareTo(lock.getExpirationDate()) < 0) { getLocksHandler.handleLock(null, lock, null); } else if (haveWriteLock) { deleteLock(lock); } } if (children.isEmpty()) { return; } for (Iterator entries = children.iterator(); entries.hasNext();) { String digestName = (String) entries.next(); File parent = new File(getDBLocksDir(), digestName.substring(0, FSFS.DIGEST_SUBDIR_LEN)); File childDigestFile = new File(parent, digestName); walkDigestFiles(childDigestFile, getLocksHandler, haveWriteLock); } }
public void unlock(Map pathToTokens, boolean force, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathToTokens.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); String token = (String) pathToTokens.get(path); String reposPath = getRepositoryPath(path); SVNErrorMessage error = null; try { myFSFS.unlockPath(reposPath, token, getUserName(), force, true); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isUnlockError(error)) { throw svne; } } if (handler != null) { handler.handleUnlock(reposPath, new SVNLock(reposPath, token, null, null, null, null), error); } } } finally { closeRepository(); } }
public void walkDigestFiles(File digestFile, ISVNLockHandler getLocksHandler, boolean haveWriteLock) throws SVNException { Collection children = new LinkedList(); SVNLock lock = fetchLockFromDigestFile(digestFile, null, children); if (lock != null) { Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() == null || current.compareTo(lock.getExpirationDate()) < 0) { getLocksHandler.handleLock(null, lock, null); } else if (haveWriteLock) { deleteLock(lock); } } if (children.isEmpty()) { return; } for (Iterator entries = children.iterator(); entries.hasNext();) { String digestName = (String) entries.next(); File parent = new File(getDBLocksDir(), digestName.substring(0, FSFS.DIGEST_SUBDIR_LEN)); File childDigestFile = new File(parent, digestName); walkDigestFiles(childDigestFile, getLocksHandler, haveWriteLock); } }
public void unlock(Map pathToTokens, boolean force, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathToTokens.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); String token = (String) pathToTokens.get(path); String reposPath = getRepositoryPath(path); SVNErrorMessage error = null; try { myFSFS.unlockPath(reposPath, token, getUserName(), force, true); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isUnlockError(error)) { throw svne; } } if (handler != null) { handler.handleUnlock(reposPath, new SVNLock(reposPath, token, null, null, null, null), error); } } } finally { closeRepository(); } }
public void walkDigestFiles(File digestFile, ISVNLockHandler getLocksHandler, boolean haveWriteLock) throws SVNException { Collection children = new LinkedList(); SVNLock lock = fetchLockFromDigestFile(digestFile, null, children); if (lock != null) { Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() == null || current.compareTo(lock.getExpirationDate()) < 0) { getLocksHandler.handleLock(lock.getPath(), lock, null); } else if (haveWriteLock) { deleteLock(lock); } } if (children.isEmpty()) { return; } for (Iterator entries = children.iterator(); entries.hasNext();) { String digestName = (String) entries.next(); File parent = new File(getDBLocksDir(), digestName.substring(0, FSFS.DIGEST_SUBDIR_LEN)); File childDigestFile = new File(parent, digestName); walkDigestFiles(childDigestFile, getLocksHandler, haveWriteLock); } }
public void unlock(Map pathToTokens, boolean force, ISVNLockHandler handler) throws SVNException { try { openRepository(); for (Iterator paths = pathToTokens.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); String token = (String) pathToTokens.get(path); String reposPath = getRepositoryPath(path); SVNErrorMessage error = null; try { myFSFS.unlockPath(reposPath, token, getUserName(), force); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isUnlockError(error)) { throw svne; } } if (handler != null) { handler.handleUnlock(reposPath, new SVNLock(reposPath, token, null, null, null, null), error); } } } finally { closeRepository(); } }
private void lock12(Map pathsToRevisions, String comment, boolean force, ISVNLockHandler handler) throws SVNException { for(Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Long revision = (Long) pathsToRevisions.get(path); path = getRepositoryPath(path); Object[] buffer = new Object[] { "lock", path, comment, Boolean.valueOf(force), revision }; write("(w(s(s)w(n)))", buffer); authenticate(); SVNErrorMessage error = null; try { read("[(L)]", buffer, false); } catch (SVNException e) { if (e.getErrorMessage() != null) { SVNErrorCode code = e.getErrorMessage().getErrorCode(); if (code == SVNErrorCode.FS_PATH_ALREADY_LOCKED || code == SVNErrorCode.FS_OUT_OF_DATE) { error = e.getErrorMessage(); } } if (error == null) { throw e; } } if (handler != null) { SVNLock lock = (SVNLock) buffer[0]; handler.handleLock(path, lock, error); } } }
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''", path); if (handler != null) { handler.handleUnlock(path, lock, err); handler.handleUnlock(path, lock, error);
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { 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())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
handler.handleUnlock(repositoryPath, new SVNLock(repositoryPath, id, null, null, null, null), error);
public void lock(Map pathsToRevisions, String comment, boolean force, ISVNLockHandler handler) throws SVNException { 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())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''", path); if (handler != null) { handler.handleUnlock(path, lock, err); handler.handleUnlock(path, lock, error);
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { 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())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
public void unlock(Map pathToTokens, boolean force, ISVNLockHandler handler) throws SVNException { try { openConnection(); for (Iterator paths = pathToTokens.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); String shortPath = path; String id = (String) pathToTokens.get(path); String repositoryPath = getRepositoryPath(path); path = getFullPath(path); path = SVNEncodingUtil.uriEncode(path); SVNErrorMessage error = null; try { myConnection.doUnlock(path, this, id, force); error = null; } catch (SVNException e) { if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_LOCKED) { error = e.getErrorMessage(); error = SVNErrorMessage.create(error.getErrorCode(), error.getMessageTemplate(), shortPath); } else { throw e; } } if (handler != null) { handler.handleUnlock(repositoryPath, new SVNLock(path, id, null, null, null, null), error); } } } finally { closeConnection(); } }
public void lock(Map pathsToRevisions, String comment, boolean force, boolean isDAVComment, ISVNLockHandler handler) throws SVNException { 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())) ? myFSFS.getYoungestRevision() : revision.longValue(); SVNLock lock = null; SVNErrorMessage error = null; try { lock = myFSFS.lockPath(reposPath, null, getUserName(), comment, null, curRevision, force, isDAVComment); } catch (SVNException svne) { error = svne.getErrorMessage(); if (!FSErrors.isLockError(error)) { throw svne; } } if (handler != null) { handler.handleLock(reposPath, lock, error); } } } finally { closeRepository(); } }
handler.handleUnlock(repositoryPath, new SVNLock(path, id, null, null, null, null), error);
private void lock12(Map pathsToRevisions, String comment, boolean force, ISVNLockHandler handler) throws SVNException { for (Iterator paths = pathsToRevisions.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Long revision = (Long) pathsToRevisions.get(path); path = getRepositoryPath(path); Object[] buffer = new Object[]{"lock", path, comment, Boolean.valueOf(force), revision}; write("(w(s(s)w(n)))", buffer); authenticate(); SVNErrorMessage error = null; List items = null; try { items = read("l", null, false); items = (List) items.get(0); } catch (SVNException e) { if (e.getErrorMessage() != null) { SVNErrorCode code = e.getErrorMessage().getErrorCode(); if (code == SVNErrorCode.FS_PATH_ALREADY_LOCKED || code == SVNErrorCode.FS_OUT_OF_DATE) { error = e.getErrorMessage(); } } if (error == null) { throw e; } } if (handler != null) { SVNLock lock = items == null ? null : SVNReader.getLock(items); handler.handleLock(path, lock, error); } } }
lock = new SVNLock(path, "", null, null, null, null); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_NOT_LOCKED, "No lock on path ''{0}''", path); handler.handleUnlock(path, lock, err); continue; handler.handleUnlock(path, lock, error);