public HTTPConnection(SVNRepository repository, String charset, File spoolDirectory, boolean spoolAll) throws SVNException { myRepository = repository; myCharset = charset; myHost = repository.getLocation().setPath("", false); myIsSecured = "https".equalsIgnoreCase(myHost.getProtocol()); myIsSpoolAll = spoolAll; mySpoolDirectory = spoolDirectory; myNextRequestTimeout = -1; }
public HTTPConnection(SVNRepository repository, String charset, File spoolDirectory, boolean spoolAll) throws SVNException { myRepository = repository; myCharset = charset; myHost = repository.getLocation().setPath("", false); myIsSecured = "https".equalsIgnoreCase(myHost.getProtocol()); myIsSpoolAll = spoolAll; mySpoolDirectory = spoolDirectory; myNextRequestTimeout = Long.MAX_VALUE; }
public HTTPConnection(SVNRepository repository, String charset, File spoolDirectory, boolean spoolAll) throws SVNException { myRepository = repository; myCharset = charset; myHost = repository.getLocation().setPath("", false); myIsSecured = "https".equalsIgnoreCase(myHost.getProtocol()); myIsSpoolAll = spoolAll; mySpoolDirectory = spoolDirectory; myNextRequestTimeout = -1; }
public void fetchRepositoryRoot(DAVRepository repository) throws SVNException { if (!repository.hasRepositoryRoot()) { String rootPath = repository.getLocation().getURIEncodedPath(); DAVBaselineInfo info = DAVUtil.getBaselineInfo(this, repository, rootPath, -1, false, false, null); // remove relative part from the path rootPath = rootPath.substring(0, rootPath.length() - info.baselinePath.length()); SVNURL location = repository.getLocation(); SVNURL url = location.setPath(rootPath, true); repository.setRepositoryRoot(url); } }
public HTTPConnection(SVNRepository repository) throws SVNException { myRepository = repository; myHost = repository.getLocation().setPath("", false); myIsSecured = "https".equalsIgnoreCase(myHost.getProtocol()); myIsKeepAlive = repository.getOptions().keepConnection(repository); }
public void fetchRepositoryRoot(DAVRepository repository) throws SVNException { if (!repository.hasRepositoryRoot()) { String rootPath = repository.getLocation().getURIEncodedPath(); DAVBaselineInfo info = DAVUtil.getBaselineInfo(this, repository, rootPath, -1, false, false, null); // remove relative part from the path rootPath = rootPath.substring(0, rootPath.length() - info.baselinePath.length()); SVNURL location = repository.getLocation(); SVNURL url = location.setPath(rootPath, true); repository.setRepositoryRoot(url); } }
public void fetchRepositoryRoot(DAVRepository repository) throws SVNException { if (!repository.hasRepositoryRoot()) { String rootPath = repository.getLocation().getURIEncodedPath(); DAVBaselineInfo info = DAVUtil.getBaselineInfo(this, repository, rootPath, -1, false, false, null); // remove relative part from the path rootPath = rootPath.substring(0, rootPath.length() - info.baselinePath.length()); SVNURL location = repository.getLocation(); SVNURL url = location.setPath(rootPath, true); repository.setRepositoryRoot(url); } }
public void fetchRepositoryRoot(DAVRepository repository) throws SVNException { if (!repository.hasRepositoryRoot()) { if (hasHttpV2Support()) { repository.setRepositoryRoot(myRepositoryRoot); } else { String rootPath = repository.getLocation().getURIEncodedPath(); DAVBaselineInfo info = DAVUtil.getBaselineInfo(this, repository, rootPath, -1, false, false, null); // remove relative part from the path rootPath = rootPath.substring(0, rootPath.length() - info.baselinePath.length()); SVNURL location = repository.getLocation(); SVNURL url = location.setPath(rootPath, true); repository.setRepositoryRoot(url); } } }
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 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)); }
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)); }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
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(); } }
public SVNDirEntry info(String path, long revision) throws SVNException { try { openConnection(); String fullPath = getFullPath(path); SVNURL url = getLocation().setPath(fullPath, false); path = getRepositoryPath(path); Object[] buffer = new Object[] { "stat", path, getRevisionObject(revision) }; write("(w(s(n)))", buffer); authenticate(); read("[((?F))]", buffer, true); SVNDirEntry entry = (SVNDirEntry) buffer[0]; if (entry != null) { entry = new SVNDirEntry(url, SVNPathUtil.tail(path), entry.getKind(), entry.getSize(), entry.hasProperties(), entry.getRevision(), entry.getDate(), entry.getAuthor()); } return entry; } catch (SVNException e) { closeSession(); handleUnsupportedCommand(e, "'stat' not implemented"); } finally { closeConnection(); } return null; }