private void openRepositoryRoot() throws SVNException { lock(); if (!"".equals(getLocation().getHost()) && !getLocation().getHost().equalsIgnoreCase("localhost")) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL, "Local URL ''{0}'' contains unsupported hostname", getLocation().toDecodedString()); SVNErrorManager.error(err); } myReposRootDir = FSFS.findRepositoryRoot(new File(getLocation().getPath())); if (myReposRootDir == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to open repository ''{0}''", getLocation().toDecodedString()); SVNErrorManager.error(err); } myFSFS = new FSFS(myReposRootDir); myFSFS.open(); String rootDir = myReposRootDir.getPath(); rootDir = rootDir.replace(File.separatorChar, '/'); if (!rootDir.startsWith("/")) { rootDir = "/" + rootDir; } setRepositoryCredentials(myFSFS.getUUID(), getLocation().setPath(rootDir, false)); }
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().toDecodedString()); 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().toDecodedString()); 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.open(); setRepositoryCredentials(myFSFS.getUUID(), getLocation().setPath(rootPath, false)); }
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().toDecodedString()); 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().toDecodedString()); 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.open(); setRepositoryCredentials(myFSFS.getUUID(), getLocation().setPath(rootPath, false)); }
private void openRepository() throws SVNException { try { openRepositoryRoot(); } catch (SVNException svne) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to connect to a repository at URL ''{0}''", getLocation().toString()); err.setChildErrorMessage(svne.getErrorMessage()); SVNErrorManager.error(err.wrap("Unable to open repository ''{0}''", new Object[]{getLocation()}), SVNLogType.FSFS); } }
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 long getDir(String path, long revision, Map properties, ISVNDirEntryHandler handler) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (handler != null) { SVNURL parentURL = getLocation().appendPath(path, false); Collection entriesCollection = getDirEntries(parent, parentURL, false); Iterator entries = entriesCollection.iterator(); while (entries.hasNext()) { SVNDirEntry entry = (SVNDirEntry) entries.next(); handler.handleDirEntry(entry); } } if (properties != null) { properties.putAll(collectProperties(parent)); } return revision; } finally { closeRepository(); } }
private void openRepository() throws SVNException { try { openRepositoryRoot(); } catch (SVNException svne) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to open repository ''{0}''", getLocation().toDecodedString()); err.setChildErrorMessage(svne.getErrorMessage()); SVNErrorManager.error(err.wrap("Unable to open an ra_local session to URL")); } }
private void openRepository() throws SVNException { try { openRepositoryRoot(); } catch (SVNException svne) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to open repository ''{0}''", getLocation().toDecodedString()); err.setChildErrorMessage(svne.getErrorMessage()); SVNErrorManager.error(err.wrap("Unable to open an ra_local session to URL"), SVNLogType.FSFS); } }
private void openRepository() throws SVNException { try { openRepositoryRoot(); } catch (SVNException svne) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_LOCAL_REPOS_OPEN_FAILED, "Unable to open repository ''{0}''", getLocation().toDecodedString()); err.setChildErrorMessage(svne.getErrorMessage()); SVNErrorManager.error(err.wrap("Unable to open an ra_local session to URL"), SVNLogType.FSFS); } }
public long getDir(String path, long revision, SVNProperties properties, int entryFields, ISVNDirEntryHandler handler) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (handler != null) { SVNURL parentURL = getLocation().appendPath(path, false); Collection entriesCollection = getDirEntries(parent, parentURL, entryFields); Iterator entries = entriesCollection.iterator(); while (entries.hasNext()) { SVNDirEntry entry = (SVNDirEntry) entries.next(); handler.handleDirEntry(entry); } } if (properties != null) { properties.putAll(collectProperties(parent)); } return revision; } finally { closeRepository(); } }
public long getDir(String path, long revision, SVNProperties properties, int entryFields, ISVNDirEntryHandler handler) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (handler != null) { SVNURL parentURL = getLocation().appendPath(path, false); Collection entriesCollection = getDirEntries(parent, parentURL, entryFields); Iterator entries = entriesCollection.iterator(); while (entries.hasNext()) { SVNDirEntry entry = (SVNDirEntry) entries.next(); handler.handleDirEntry(entry); } } if (properties != null) { properties.putAll(collectProperties(parent)); } return revision; } finally { closeRepository(); } }
public long getDir(String path, long revision, SVNProperties properties, int entryFields, ISVNDirEntryHandler handler) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (handler != null) { SVNURL parentURL = getLocation().appendPath(path, false); Collection entriesCollection = getDirEntries(parent, parentURL, entryFields); Iterator entries = entriesCollection.iterator(); while (entries.hasNext()) { SVNDirEntry entry = (SVNDirEntry) entries.next(); handler.handleDirEntry(entry); } } if (properties != null) { properties.putAll(collectProperties(parent)); } return revision; } finally { closeRepository(); } }
public SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); SVNURL parentURL = getLocation().appendPath(path, false); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (entries != null) { entries.addAll(getDirEntries(parent, parentURL, SVNDirEntry.DIRENT_ALL)); } SVNDirEntry parentDirEntry = buildDirEntry(new FSEntry(parent.getId(), parent.getType(), ""), parentURL, parent, SVNDirEntry.DIRENT_ALL); return parentDirEntry; } finally { closeRepository(); } }
public SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); SVNURL parentURL = getLocation().appendPath(path, false); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (entries != null) { entries.addAll(getDirEntries(parent, parentURL, SVNDirEntry.DIRENT_ALL)); } SVNDirEntry parentDirEntry = buildDirEntry(new FSEntry(parent.getId(), parent.getType(), ""), parentURL, parent, SVNDirEntry.DIRENT_ALL); return parentDirEntry; } finally { closeRepository(); } }
public SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); SVNURL parentURL = getLocation().appendPath(path, false); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (entries != null) { entries.addAll(getDirEntries(parent, parentURL, SVNDirEntry.DIRENT_ALL)); } SVNDirEntry parentDirEntry = buildDirEntry(new FSEntry(parent.getId(), parent.getType(), ""), parentURL, parent, SVNDirEntry.DIRENT_ALL); return parentDirEntry; } finally { closeRepository(); } }
public SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries) throws SVNException { try { openRepository(); if (!SVNRepository.isValidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } String repositoryPath = getRepositoryPath(path); SVNURL parentURL = getLocation().appendPath(path, false); FSRevisionRoot root = myFSFS.createRevisionRoot(revision); FSRevisionNode parent = root.getRevisionNode(repositoryPath); if (entries != null) { entries.addAll(getDirEntries(parent, parentURL, includeCommitMessages)); } SVNDirEntry parentDirEntry = buildDirEntry(new FSEntry(parent.getId(), parent.getType(), ""), parentURL, parent, false); return parentDirEntry; } finally { closeRepository(); } }
public SVNDirEntry info(String path, long revision) throws SVNException { try { openRepository(); path = getRepositoryPath(path); if (FSRepository.isInvalidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } FSRevisionRoot root = myFSFS.createRevisionRoot(revision); if (root.checkNodeKind(path) == SVNNodeKind.NONE) { return null; } FSRevisionNode revNode = root.getRevisionNode(path); String fullPath = getFullPath(path); String parentFullPath = "/".equals(path) ? fullPath : SVNPathUtil.removeTail(fullPath); SVNURL url = getLocation().setPath(parentFullPath, false); String name = "/".equals(path) ? "" : SVNPathUtil.tail(path); FSEntry fsEntry = new FSEntry(revNode.getId(), revNode.getType(), name); SVNDirEntry entry = buildDirEntry(fsEntry, url, revNode, SVNDirEntry.DIRENT_ALL); return entry; } finally { closeRepository(); } }
public SVNDirEntry info(String path, long revision) throws SVNException { try { openRepository(); path = getRepositoryPath(path); if (FSRepository.isInvalidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } FSRevisionRoot root = myFSFS.createRevisionRoot(revision); if (root.checkNodeKind(path) == SVNNodeKind.NONE) { return null; } FSRevisionNode revNode = root.getRevisionNode(path); String fullPath = getFullPath(path); String parentFullPath = "/".equals(path) ? fullPath : SVNPathUtil.removeTail(fullPath); SVNURL url = getLocation().setPath(parentFullPath, false); String name = SVNPathUtil.tail(path); FSEntry fsEntry = new FSEntry(revNode.getId(), revNode.getType(), name); SVNDirEntry entry = buildDirEntry(fsEntry, url, revNode, SVNDirEntry.DIRENT_ALL); return entry; } finally { closeRepository(); } }
public SVNDirEntry info(String path, long revision) throws SVNException { try { openRepository(); path = getRepositoryPath(path); if (FSRepository.isInvalidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } FSRevisionRoot root = myFSFS.createRevisionRoot(revision); if (root.checkNodeKind(path) == SVNNodeKind.NONE) { return null; } FSRevisionNode revNode = root.getRevisionNode(path); String fullPath = getFullPath(path); String parentFullPath = "/".equals(path) ? fullPath : SVNPathUtil.removeTail(fullPath); SVNURL url = getLocation().setPath(parentFullPath, false); String name = SVNPathUtil.tail(path); FSEntry fsEntry = new FSEntry(revNode.getId(), revNode.getType(), name); SVNDirEntry entry = buildDirEntry(fsEntry, url, revNode, false); return entry; } finally { closeRepository(); } }
public SVNDirEntry info(String path, long revision) throws SVNException { try { openRepository(); path = getRepositoryPath(path); if (FSRepository.isInvalidRevision(revision)) { revision = myFSFS.getYoungestRevision(); } FSRevisionRoot root = myFSFS.createRevisionRoot(revision); if (root.checkNodeKind(path) == SVNNodeKind.NONE) { return null; } FSRevisionNode revNode = root.getRevisionNode(path); String fullPath = getFullPath(path); String parentFullPath = "/".equals(path) ? fullPath : SVNPathUtil.removeTail(fullPath); SVNURL url = getLocation().setPath(parentFullPath, false); String name = SVNPathUtil.tail(path); FSEntry fsEntry = new FSEntry(revNode.getId(), revNode.getType(), name); SVNDirEntry entry = buildDirEntry(fsEntry, url, revNode, SVNDirEntry.DIRENT_ALL); return entry; } finally { closeRepository(); } }