public void setHooksEnabled(boolean enabled) { myIsHooksEnabled = enabled; if (getFSFS() != null) { getFSFS().setHooksEnabled(isHooksEnabled()); } }
private void openRepositoryRoot() throws SVNException { lock(); String hostName = getLocation().getHost(); boolean hasCustomHostName = !"".equals(hostName) && !"localhost".equalsIgnoreCase(hostName); if (!SVNFileUtil.isWindows && hasCustomHostName) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL, "Local URL ''{0}'' contains unsupported hostname", getLocation().toString()); SVNErrorManager.error(err, SVNLogType.FSFS); } String startPath = SVNEncodingUtil.uriDecode(getLocation().getURIEncodedPath()); String rootPath = FSFS.findRepositoryRoot(hasCustomHostName ? hostName : null, startPath); if (rootPath == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to open repository ''{0}''", getLocation().toString()); SVNErrorManager.error(err, SVNLogType.FSFS); } String dirPath = rootPath.replaceFirst("\\|", "\\:"); myReposRootDir = hasCustomHostName ? new File("\\\\" + hostName, dirPath).getAbsoluteFile() : new File(dirPath).getAbsoluteFile(); myFSFS = new FSFS(myReposRootDir); myFSFS.setHooksEnabled(isHooksEnabled()); myFSFS.open(); setRepositoryCredentials(myFSFS.getUUID(), getLocation().setPath(rootPath, false)); }
public void setRevisionPropertyValue(long revision, String propertyName, SVNPropertyValue propertyValue, boolean bypassPreRevpropHook, boolean bypassPostRevpropHook) throws SVNException { assertValidRevision(revision); try { openRepository(); FSRepositoryUtil.validateProperty(propertyName, propertyValue); String userName = getUserName(); SVNProperties revProps = myFSFS.getRevisionProperties(revision); SVNPropertyValue oldValue = revProps.getSVNPropertyValue(propertyName); String action = null; if (propertyValue == null) { action = FSHooks.REVPROP_DELETE; } else if (oldValue == null) { action = FSHooks.REVPROP_ADD; } else { action = FSHooks.REVPROP_MODIFY; } byte[] bytes = SVNPropertyValue.getPropertyAsBytes(propertyValue); if (isHooksEnabled() && FSHooks.isHooksEnabled() && !bypassPreRevpropHook) { FSHooks.runPreRevPropChangeHook(myReposRootDir, propertyName, bytes, userName, revision, action); } myFSFS.setRevisionProperty(revision, propertyName, propertyValue); if (isHooksEnabled() && FSHooks.isHooksEnabled() && !bypassPostRevpropHook) { FSHooks.runPostRevPropChangeHook(myReposRootDir, propertyName, bytes, userName, revision, action); } } finally { closeRepository(); } }