private String[] getRepositoryPaths(String[] paths) throws SVNException { if (paths == null || paths.length == 0) { return paths; } String[] fullPaths = new String[paths.length]; for (int i = 0; i < paths.length; i++) { fullPaths[i] = getRepositoryPath(paths[i]); } return fullPaths; }
private String[] getRepositoryPaths(String[] paths) throws SVNException { if (paths == null || paths.length == 0) { return paths; } String[] fullPaths = new String[paths.length]; for (int i = 0; i < paths.length; i++) { fullPaths[i] = getRepositoryPath(paths[i]); } return fullPaths; }
private String[] getRepositoryPaths(String[] paths) throws SVNException { if (paths == null || paths.length == 0) { return paths; } String[] fullPaths = new String[paths.length]; for (int i = 0; i < paths.length; i++) { fullPaths[i] = getRepositoryPath(paths[i]); } return fullPaths; }
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); } } }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton)myDirsStack.peek(); String fileToken = "c" + myNextToken++; if (copyFromPath != null) { String host = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(host, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[] { "add-file", path, parentBaton.getToken(), fileToken, copyFromPath, getRevisionObject(copyFromRevision) }); } else { myConnection.write("(w(sss()))", new Object[] { "add-file", path, parentBaton.getToken(), fileToken }); } if(myFilesToTokens == null){ myFilesToTokens = new HashMap(); } myFilesToTokens.put(path, fileToken); }
public SVNLock[] getLocks(String path) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[] { "get-locks", path }; write("(w(s))", buffer); authenticate(); read("[((*L))]", buffer, true); Collection lockObjects = (Collection) buffer[0]; return lockObjects == null ? new SVNLock[0] : (SVNLock[]) lockObjects.toArray(new SVNLock[lockObjects.size()]); } catch (SVNException e) { closeSession(); handleUnsupportedCommand(e, "Server doesn't support the get-lock command"); } finally { closeConnection(); } return null; }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); String fileToken = "c" + myNextToken++; if (copyFromPath != null) { String host = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(host, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken, copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken}); } if (myFilesToTokens == null) { myFilesToTokens = new SVNHashMap(); } myFilesToTokens.put(path, fileToken); }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); String fileToken = "c" + myNextToken++; if (copyFromPath != null) { String host = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(host, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken, copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken}); } if (myFilesToTokens == null) { myFilesToTokens = new SVNHashMap(); } myFilesToTokens.put(path, fileToken); }
public SVNLock getLock(String path) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[]{"get-lock", path}; write("(w(s))", buffer); authenticate(); List items = read("(?l)", null, false); items = (List) items.get(0); return SVNReader.getLock(items); } catch (SVNException e) { closeSession(); handleUnsupportedCommand(e, "Server doesn't support the get-lock command"); } finally { closeConnection(); } return null; }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); String fileToken = "c" + myNextToken++; if (copyFromPath != null) { String host = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(host, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken, copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-file", path, parentBaton.getToken(), fileToken}); } if (myFilesToTokens == null) { myFilesToTokens = new SVNHashMap(); } myFilesToTokens.put(path, fileToken); }
public SVNLock getLock(String path) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[]{"get-lock", path}; write("(w(s))", buffer); authenticate(); List items = read("(?l)", null, false); items = (List) items.get(0); return SVNReader.getLock(items); } catch (SVNException e) { closeSession(); handleUnsupportedCommand(e, "Server doesn't support the get-lock command"); } finally { closeConnection(); } return null; }
public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); DirBaton dirBaton = new DirBaton(myNextToken++); if (copyFromPath != null) { String rootURL = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(rootURL, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken(), copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken()}); } myDirsStack.push(dirBaton); }
public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); DirBaton dirBaton = new DirBaton(myNextToken++); if (copyFromPath != null) { String rootURL = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(rootURL, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken(), copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken()}); } myDirsStack.push(dirBaton); }
public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton)myDirsStack.peek(); DirBaton dirBaton = new DirBaton(myNextToken++); if (copyFromPath != null) { String rootURL = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(rootURL, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[] { "add-dir", path, parentBaton.getToken(), dirBaton.getToken(), copyFromPath, getRevisionObject(copyFromRevision) }); } else { myConnection.write("(w(sss()))", new Object[] { "add-dir", path, parentBaton.getToken(), dirBaton.getToken() }); } myDirsStack.push(dirBaton); }
public SVNLock getLock(String path) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[] { "get-lock", path }; write("(w(s))", buffer); authenticate(); read("[((?L))]", buffer, true); return (SVNLock) buffer[0]; } catch (SVNException e) { closeSession(); handleUnsupportedCommand(e, "Server doesn't support the get-lock command"); } finally { closeConnection(); } return null; }
public SVNNodeKind checkPath(String path, long revision) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[] { "check-path", path, getRevisionObject(revision) }; write("(w(s(n)))", buffer); authenticate(); read("[(W)]", buffer, true); return SVNNodeKind.parseKind((String) buffer[0]); } catch (SVNException e) { closeSession(); throw e; } finally { closeConnection(); } }
public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException { DirBaton parentBaton = (DirBaton) myDirsStack.peek(); DirBaton dirBaton = new DirBaton(myNextToken++); if (copyFromPath != null) { if (!SVNRevision.isValidRevisionNumber(copyFromRevision)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Got source path but no source revision for ''{0}''", path); SVNErrorManager.error(err, SVNLogType.NETWORK); } String rootURL = myRepository.getRepositoryRoot(false).toString(); copyFromPath = SVNPathUtil.append(rootURL, SVNEncodingUtil.uriEncode(myRepository.getRepositoryPath(copyFromPath))); myConnection.write("(w(sss(sn)))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken(), copyFromPath, getRevisionObject(copyFromRevision)}); } else { myConnection.write("(w(sss()))", new Object[]{"add-dir", path, parentBaton.getToken(), dirBaton.getToken()}); } myDirsStack.push(dirBaton); }
public SVNNodeKind checkPath(String path, long revision) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[]{"check-path", path, getRevisionObject(revision)}; write("(w(s(n)))", buffer); authenticate(); List values = read("w", null, false); return SVNNodeKind.parseKind(SVNReader.getString(values, 0)); } catch (SVNException e) { closeSession(); throw e; } finally { closeConnection(); } }
public SVNNodeKind checkPath(String path, long revision) throws SVNException { try { openConnection(); path = getRepositoryPath(path); Object[] buffer = new Object[]{"check-path", path, getRevisionObject(revision)}; write("(w(s(n)))", buffer); authenticate(); List values = read("w", null, false); return SVNNodeKind.parseKind(SVNReader.getString(values, 0)); } catch (SVNException e) { closeSession(); throw e; } finally { closeConnection(); } }
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; }