public void dispose() { if (svnRepository != null) { svnRepository.closeSession(); } }
@Override public void close() { repo.closeSession(); } }
private void shutdownInactiveRepositories(long currentTime) { synchronized (myInactiveRepositories) { for (Iterator<SVNRepository> repositories = myInactiveRepositories.keySet().iterator(); repositories.hasNext();) { SVNRepository repos = repositories.next(); long time = ((Long) myInactiveRepositories.get(repos)).longValue(); if (currentTime - time >= getTimeout()) { repositories.remove(); repos.closeSession(); } } } }
public void run() { clientManager.dispose(); repository.closeSession(); } }
/** * Aborts the transaction. * * @throws SVNException */ public void abortEdit() throws SVNException { if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } myCommitEditor.abortEdit(); }
/** * Aborts the transaction. * * @throws SVNException */ public void abortEdit() throws SVNException { if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } myCommitEditor.abortEdit(); }
/** * Aborts the transaction. * * @throws SVNException */ public void abortEdit() throws SVNException { if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } myCommitEditor.abortEdit(); }
FSRepositoryFactory.setup(); File pathToRepository = new File("/path/to/repository"); SVNRepository svnRepository = SVNRepositoryFactory.create(SVNURL.fromFile(pathToRepository)); try { final long latestRevision = svnRepository.getLatestRevision(); System.out.println("latestRevision = " + latestRevision); } finally { svnRepository.closeSession(); }
/** * Commits the transaction. * @return commit info * @throws SVNException */ public SVNCommitInfo closeEdit() throws SVNException { myCommitInfo = myCommitEditor.closeEdit(); if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } return myCommitInfo; }
/** * Commits the transaction. * @return commit info * @throws SVNException */ public SVNCommitInfo closeEdit() throws SVNException { myCommitInfo = myCommitEditor.closeEdit(); if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } return myCommitInfo; }
/** * Commits the transaction. * @return commit info * @throws SVNException */ public SVNCommitInfo closeEdit() throws SVNException { myCommitInfo = myCommitEditor.closeEdit(); if (mySourceRepository != null) { mySourceRepository.closeSession(); mySourceRepository = null; } return myCommitInfo; }
private static void clearPool(Map pool, boolean force) { for (Iterator references = pool.keySet().iterator(); references.hasNext();) { WeakReference reference = (WeakReference) references.next(); if (force || reference.get() == null) { Map repositoriesMap = (Map) pool.get(reference); for (Iterator repos = repositoriesMap.values().iterator(); repos.hasNext();) { SVNRepository repo = (SVNRepository) repos.next(); try { repo.closeSession(); } catch (SVNException e) { } repos.remove(); } references.remove(); } } }
public void close() { if (isClosed()) { return; } repository.closeSession(); cache.close(); }
private boolean checkPassword(SVNURL url, String user, String password) throws SVNException { SVNRepository svnRepository = SVNRepositoryFactory.create(url); try { svnRepository.setAuthenticationManager(new BasicAuthenticationManager(user, password)); svnRepository.testConnection(); return true; } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_AUTHORIZED) { return false; } else { throw e; } } finally { svnRepository.closeSession(); } }
@Override public ChangeSet getHead() { SVNRepository repository = null; try { SVNURL url = SVNURL.parseURIEncoded(path); repository = SVNRepositoryFactory.create(url); authenticateIfNecessary(repository); SVNDirEntry entry = repository.info("/", -1); return new ChangeSet(String.valueOf(entry.getRevision()), convertToCalendar(entry.getDate())); } catch (SVNException e) { throw new RuntimeException("error in getHead() for " + path, e); } finally { if (repository != null) repository.closeSession(); } }
public SVNNodeKind checkRepositoryPath(AbstractProject context, SVNURL repoURL) throws SVNException { SVNRepository repository = null; try { repository = getRepository(context, repoURL); repository.testConnection(); long rev = repository.getLatestRevision(); String repoPath = getRelativePath(repoURL, repository); return repository.checkPath(repoPath, rev); } finally { if (repository != null) { repository.closeSession(); } } }
public SVNNodeKind checkRepositoryPath(AbstractProject context, SVNURL repoURL) throws SVNException { SVNRepository repository = null; try { repository = getRepository(context, repoURL); repository.testConnection(); long rev = repository.getLatestRevision(); String repoPath = getRelativePath(repoURL, repository); return repository.checkPath(repoPath, rev); } finally { if (repository != null) { repository.closeSession(); } } }
public SCMRepository info() { SVNRepository repository = null; try { SVNURL url = SVNURL.parseURIEncoded(path); repository = SVNRepositoryFactory.create(url); authenticateIfNecessary(repository); SVNDirEntry firstRevision = repository.info("/", 0); SVNDirEntry lastRevision = repository.info("/", SVNRevision.HEAD.getNumber()); return new SCMRepository(this, lastRevision.getURL().getPath(), path, String.valueOf(lastRevision.getRevision()), String.valueOf(firstRevision .getRevision())); } catch (SVNException e) { throw new RuntimeException("error in getHead() for " + path, e); } finally { if (repository != null) repository.closeSession(); } }
private void attemptAccess(ISVNAuthenticationManager m) throws SVNException { SVNRepository repository = SVNRepositoryFactory.create(repo); try { repository.setAuthenticationManager(m); repository.testConnection(); } finally { repository.closeSession(); } }
public SvnTesterExternal(@NotNull SVNURL url, @Nullable ISVNAuthenticationManager authManager) throws SVNException { this.url = url; this.authManager = authManager; this.suffix = UUID.randomUUID().toString(); final SVNRepository repo = openSvnRepository(url); try { final ISVNEditor editor = repo.getCommitEditor("Create subdir for test", null, false, null); editor.openRoot(-1); editor.addDir(suffix, null, -1); editor.closeDir(); editor.closeEdit(); } finally { repo.closeSession(); } }