public FSRevisionNode getRevisionNode(String path) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); FSRevisionNode node = fetchRevNodeFromCache(path); if (node == null) { FSParentPath parentPath = openPath(path, true, false); node = parentPath.getRevNode(); } return node; }
public FSRevisionNode getRevisionNode(String path) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); FSRevisionNode node = fetchRevNodeFromCache(path); if (node == null) { FSParentPath parentPath = openPath(path, true, false); node = parentPath.getRevNode(); } return node; }
public FSRevisionNode getRevisionNode(String path) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); FSRevisionNode node = fetchRevNodeFromCache(path); if (node == null) { FSParentPath parentPath = openPath(path, true, false); node = parentPath.getRevNode(); } return node; }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
public String getDigestFromRepositoryPath(String repositoryPath) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); MessageDigest digestFromPath = null; try { digestFromPath = MessageDigest.getInstance("MD5"); digestFromPath.update(repositoryPath.getBytes("UTF-8")); } catch (NoSuchAlgorithmException nsae) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", nsae.getLocalizedMessage()); SVNErrorManager.error(err, nsae, SVNLogType.FSFS); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } return SVNFileUtil.toHexDigest(digestFromPath); }
public static void allowLockedOperation(FSFS fsfs, String path, final String username, final Collection lockTokens, boolean recursive, boolean haveWriteLock) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); if (recursive) { ISVNLockHandler handler = new ISVNLockHandler() { private String myUsername = username; private Collection myTokens = lockTokens; public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { verifyLock(lock, myTokens, myUsername); } public void handleUnlock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { } }; fsfs.walkDigestFiles(fsfs.getDigestFileFromRepositoryPath(path), handler, haveWriteLock); } else { SVNLock lock = fsfs.getLockHelper(path, haveWriteLock); if (lock != null) { verifyLock(lock, lockTokens, username); } } }
public static void allowLockedOperation(FSFS fsfs, String path, final String username, final Collection lockTokens, boolean recursive, boolean haveWriteLock) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); if (recursive) { ISVNLockHandler handler = new ISVNLockHandler() { private String myUsername = username; private Collection myTokens = lockTokens; public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { verifyLock(lock, myTokens, myUsername); } public void handleUnlock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { } }; fsfs.walkDigestFiles(fsfs.getDigestFileFromRepositoryPath(path), handler, haveWriteLock); } else { SVNLock lock = fsfs.getLockHelper(path, haveWriteLock); if (lock != null) { verifyLock(lock, lockTokens, username); } } }
public SVNLock getLock(String repositoryPath, boolean haveWriteLock, boolean throwError) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); SVNLock lock = fetchLockFromDigestFile(null, repositoryPath, null); if (lock == null) { if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorNoSuchLock(repositoryPath, this), SVNLogType.FSFS); } Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() != null && current.compareTo(lock.getExpirationDate()) > 0) { if (haveWriteLock) { deleteLock(lock); } if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorLockExpired(lock.getID(), this), SVNLogType.FSFS); } return lock; }
public SVNLock getLock(String repositoryPath, boolean haveWriteLock, boolean throwError) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); SVNLock lock = fetchLockFromDigestFile(null, repositoryPath, null); if (lock == null) { if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorNoSuchLock(repositoryPath, this), SVNLogType.FSFS); } Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() != null && current.compareTo(lock.getExpirationDate()) > 0) { if (haveWriteLock) { deleteLock(lock); } if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorLockExpired(lock.getID(), this), SVNLogType.FSFS); } return lock; }
public SVNLock getLock(String repositoryPath, boolean haveWriteLock, boolean throwError) throws SVNException { repositoryPath = SVNPathUtil.canonicalizeAbsolutePath(repositoryPath); SVNLock lock = fetchLockFromDigestFile(null, repositoryPath, null); if (lock == null) { if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorNoSuchLock(repositoryPath, this), SVNLogType.FSFS); } Date current = new Date(System.currentTimeMillis()); if (lock.getExpirationDate() != null && current.compareTo(lock.getExpirationDate()) > 0) { if (haveWriteLock) { deleteLock(lock); } if (!throwError) { return null; } SVNErrorManager.error(FSErrors.errorLockExpired(lock.getID(), this), SVNLogType.FSFS); } return lock; }
public void addChange(String path, FSID id, FSPathChangeKind changeKind, boolean textModified, boolean propsModified, long copyFromRevision, String copyFromPath, SVNNodeKind kind) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); OutputStream changesFile = null; try { changesFile = SVNFileUtil.openFileForWriting(myTxnRoot.getTransactionChangesFile(), true); FSPathChange pathChange = new FSPathChange(path, id, changeKind, textModified, propsModified, copyFromPath, copyFromRevision, kind); myTxnRoot.writeChangeEntry(changesFile, pathChange, true); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(changesFile); } }
public void addChange(String path, FSID id, FSPathChangeKind changeKind, boolean textModified, boolean propsModified, long copyFromRevision, String copyFromPath, SVNNodeKind kind) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); OutputStream changesFile = null; try { changesFile = SVNFileUtil.openFileForWriting(myTxnRoot.getTransactionChangesFile(), true); FSPathChange pathChange = new FSPathChange(path, id, changeKind, textModified, propsModified, copyFromPath, copyFromRevision, kind); myTxnRoot.writeChangeEntry(changesFile, pathChange, true); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(changesFile); } }
public void addChange(String path, FSID id, FSPathChangeKind changeKind, boolean textModified, boolean propsModified, boolean mergeInfoModified, long copyFromRevision, String copyFromPath, SVNNodeKind kind) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); OutputStream changesFile = null; try { FSTransactionRoot txnRoot = getTxnRoot(); changesFile = SVNFileUtil.openFileForWriting(txnRoot.getTransactionChangesFile(), true); FSPathChange pathChange = new FSPathChange(path, id, changeKind, textModified, propsModified, mergeInfoModified, copyFromPath, copyFromRevision, kind); txnRoot.writeChangeEntry(changesFile, pathChange, true); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(changesFile); } }
public void allowLockedOperation(FSFS fsfs, String path, final String username, final Collection<String> lockTokens, boolean recursive, boolean haveWriteLock) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); if (recursive) { ISVNLockHandler handler = new ISVNLockHandler() { public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { if (isAutoUnlock()) { scheduleForAutoUnlock(username, path, lock); } else { verifyLock(lock, lockTokens, username); } } public void handleUnlock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException { } }; fsfs.walkDigestFiles(fsfs.getDigestFileFromRepositoryPath(path), handler, haveWriteLock); } else { SVNLock lock = fsfs.getLockHelper(path, haveWriteLock); if (lock != null) { if (isAutoUnlock()) { scheduleForAutoUnlock(username, path, lock); } else { verifyLock(lock, lockTokens, username); } } } }
public FSNodeHistory getNodeHistory(String path) throws SVNException { SVNNodeKind kind = checkNodeKind(path); if (kind == SVNNodeKind.NONE) { SVNErrorManager.error(FSErrors.errorNotFound(this, path), SVNLogType.FSFS); } return new FSNodeHistory(new SVNLocationEntry(getRevision(), SVNPathUtil.canonicalizeAbsolutePath(path)), false, new SVNLocationEntry(SVNRepository.INVALID_REVISION, null), getOwner()); }
public FSNodeHistory getNodeHistory(String path) throws SVNException { SVNNodeKind kind = checkNodeKind(path); if (kind == SVNNodeKind.NONE) { SVNErrorManager.error(FSErrors.errorNotFound(this, path), SVNLogType.FSFS); } return new FSNodeHistory(new SVNLocationEntry(getRevision(), SVNPathUtil.canonicalizeAbsolutePath(path)), false, new SVNLocationEntry(SVNRepository.INVALID_REVISION, null), getOwner()); }
public FSNodeHistory getNodeHistory(String path) throws SVNException { SVNNodeKind kind = checkNodeKind(path); if (kind == SVNNodeKind.NONE) { SVNErrorManager.error(FSErrors.errorNotFound(this, path), SVNLogType.FSFS); } return new FSNodeHistory(new SVNLocationEntry(getRevision(), SVNPathUtil.canonicalizeAbsolutePath(path)), false, new SVNLocationEntry(SVNRepository.INVALID_REVISION, null), getOwner()); }
public SVNLock lockPath(String path, String token, String username, String comment, Date expirationDate, long currentRevision, boolean stealLock, boolean isDAVComment) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path);
public void unlockPath(String path, String token, String username, boolean breakLock, boolean enableHooks) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); String[] paths = {path}; if (!breakLock && username == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NO_USER, "Cannot unlock path ''{0}'', no authenticated username available", path); SVNErrorManager.error(err, SVNLogType.FSFS); } if (enableHooks && isHooksEnabled()) { FSHooks.runPreUnlockHook(myRepositoryRoot, path, username); } FSWriteLock writeLock = FSWriteLock.getWriteLockForDB(this); synchronized (writeLock) { try { writeLock.lock(); unlock(path, token, username, breakLock); } finally { writeLock.unlock(); FSWriteLock.release(writeLock); } } if (enableHooks && isHooksEnabled()) { try { FSHooks.runPostUnlockHook(myRepositoryRoot, paths, username); } catch (SVNException svne) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_POST_UNLOCK_HOOK_FAILED, "Unlock succeeded, but post-unlock hook failed"); err.setChildErrorMessage(svne.getErrorMessage()); SVNErrorManager.error(err, svne, SVNLogType.FSFS); } } }