private boolean exists(String child) throws SVNException { try { return queryRepo.info(child,-1)!=null; } catch (SVNException e) { // https:// protocol reports an error whereas it should return null return false; } }
/** * Checks to see if given repository contains a trunk, branches, and tags * directories. * * @param repo Repository to check. * @return True if trunk, branches, and tags exist. */ private boolean isSVNRepositoryProjectRoot(SVNRepository repo) { try { if (repo.info(SVN_TRUNK, SVNRevision.HEAD.getNumber()) != null && repo.info(SVN_BRANCHES, SVNRevision.HEAD.getNumber()) != null && repo.info(SVN_TAGS, SVNRevision.HEAD.getNumber()) != null) { return true; } } catch (SVNException e) { return false; } return false; }
DAVRepositoryFactory.setup(); String url = "(directory in svn url)"; String name = "(login name)"; String password = "(login password)"; SVNRepository repository = null; repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); repository.setAuthenticationManager(authManager); SVNDirEntry entry = repository.info(".", -1); System.out.println("Latest Rev: " + entry.getRevision());
public SVNDirEntry info() throws SVNException { return root.getRepository().info(path, SVNRevision.HEAD.getNumber()); }
private void checkClockOutOfSync() { try { for (ModuleLocation l : locations) { SVNDirEntry dir = manager.createRepository(l.getSVNURL(), true).info("/", -1); // see http://www.nabble.com/NullPointerException-in-SVN-Checkout-Update-td21609781.html that reported this being null. if (dir != null && dir.getDate() != null && dir.getDate().after(new Date())) { listener.getLogger().println(Messages.SubversionSCM_ClockOutOfSync()); } } } catch (SVNAuthenticationException e) { // if we don't have access to '/', ignore. error LOGGER.log(Level.FINE, "Failed to estimate the remote time stamp", e); } catch (SVNException e) { LOGGER.log(Level.INFO, "Failed to estimate the remote time stamp", e); } }
private void checkClockOutOfSync() { try { SVNDirEntry dir = clientManager.createRepository(location.getSVNURL(), true).info("/", -1); if (dir != null) {// I don't think this can ever be null, but be defensive if (dir.getDate() != null && dir.getDate().after(new Date())) // see http://www.nabble.com/NullPointerException-in-SVN-Checkout-Update-td21609781.html that reported this being null. { listener.getLogger().println(Messages.SubversionSCM_ClockOutOfSync()); } } } catch (SVNAuthenticationException e) { // if we don't have access to '/', ignore. error LOGGER.log(Level.FINE,"Failed to estimate the remote time stamp",e); } catch (SVNException e) { LOGGER.log(Level.INFO,"Failed to estimate the remote time stamp",e); } }
private void checkClockOutOfSync() { try { for (ModuleLocation l : locations) { SVNDirEntry dir = manager.createRepository(l.getSVNURL(), true).info("/", -1); // see http://www.nabble.com/NullPointerException-in-SVN-Checkout-Update-td21609781.html that reported this being null. if (dir != null && dir.getDate() != null && dir.getDate().after(new Date())) { listener.getLogger().println(Messages.SubversionSCM_ClockOutOfSync()); } } } catch (SVNAuthenticationException e) { // if we don't have access to '/', ignore. error LOGGER.log(Level.FINE, "Failed to estimate the remote time stamp", e); } catch (SVNException e) { LOGGER.log(Level.INFO, "Failed to estimate the remote time stamp", e); } }
private SVNDirEntry getInfo() throws IOException { try { return fs.getRepository().info(getPath(), fs.getLatestRevision()); } catch (SVNException e) { throw new IOException("failed to get file info for " + getPath(), e); } } }
public DirEntry stat(String path, long revision) throws ClientException { try { final SVNDirEntry dirEntry = svnRepository.info(path, revision); return SVNClientImpl.getDirEntry(dirEntry, getRepositoryRelativePath(path)); } catch (SVNException e) { throw ClientException.fromException(e); } }
@Override public long size() throws SizeException { SVNDirEntry entry; try { entry = root.getRepository().info(path, -1); if (entry == null || entry.getKind() != SVNNodeKind.FILE) { throw new SizeException(this, new IOException("file expected")); } return entry.getSize(); } catch (SVNException e) { throw new SizeException(this, e); } }
@Override public long length() throws LengthException { SVNDirEntry entry; try { entry = root.getRepository().info(path, -1); if (entry == null || entry.getKind() != SVNNodeKind.FILE) { throw new LengthException(this, new IOException("file expected")); } return entry.getSize(); } catch (SVNException e) { throw new LengthException(this, e); } }
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(); } }
SVNDirEntry dirEntry = repository.info(path, mergeRange.getEndRevision()); if (mergeRangeContainsRevision(mergeRange, dirEntry.getRevision())) { SVNURL fullURL = repository.getLocation();
SVNDirEntry dirEntry = repository.info(path, mergeRange.getEndRevision()); if (mergeRangeContainsRevision(mergeRange, dirEntry.getRevision())) { SVNURL fullURL = repository.getLocation();
SVNDirEntry dirEntry = repository.info(path, mergeRange.getEndRevision()); if (mergeRangeContainsRevision(mergeRange, dirEntry.getRevision())) { SVNURL fullURL = repository.getLocation();
public boolean getIfNewer(String resourceName, File destination, long timestamp) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { try { SVNDirEntry e = queryRepo.info(combine(rootPath,resourceName), -1/*head*/); if( e.getDate().getTime() < timestamp ) return false; // older get(resourceName,destination); return true; } catch (SVNException e) { throw new ResourceDoesNotExistException("Unable to find "+resourceName+" in "+getRepository().getUrl(),e); } }
@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 Date getLastModified(long revision) throws GetLastModifiedException { try { if (!exists()) { throw new GetLastModifiedException(this, null); } } catch (ExistsException e) { throw new GetLastModifiedException(this, e); } try { return root.getRepository().info(path, revision).getDate(); } catch (SVNException e) { throw new GetLastModifiedException(this, e); } }
public Date getLastModified(long revision) throws GetLastModifiedException { try { if (!exists()) { throw new GetLastModifiedException(this, null); } } catch (ExistsException e) { throw new GetLastModifiedException(this, e); } try { return root.getRepository().info(path, revision).getDate(); } catch (SVNException e) { throw new GetLastModifiedException(this, e); } }
/** * {@inheritDoc} */ @Override public void testRepository(ScmCriteria criteria) throws Exception { SVNRepository repository = null; try { repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(criteria.getServer())); if (criteria.isAuth()) { repository.setAuthenticationManager(FactoryAuthenticationManager.create(criteria)); } long revision = -1; SVNDirEntry dir = repository.info(".", revision); if (dir == null) { throw new Exception("Error reading the repository information."); } revision = dir.getRevision(); LOGGER.log(Level.INFO, "Revision {0} is the last in the repository {1}", new Object[]{revision, criteria.getServer()}); } finally { if (repository != null) { repository.closeSession(); } } } }