private String update(SvnOperationFactory svnOperationFactory, String label) throws SVNException { logger.debug("Repo already checked out - updating instead."); try { final SvnUpdate update = svnOperationFactory.createUpdate(); update.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory())); long[] ids = update.run(); StringBuilder version = new StringBuilder(); for (long id : ids) { if (version.length() > 0) { version.append(","); } version.append(id); } return version.toString(); } catch (Exception e) { String message = "Could not update remote for " + label + " (current local=" + getWorkingDirectory().getPath() + "), remote: " + this.getUri() + ")"; if (logger.isDebugEnabled()) { logger.debug(message, e); } else if (logger.isWarnEnabled()) { logger.warn(message); } } final SVNStatus status = SVNClientManager.newInstance().getStatusClient() .doStatus(getWorkingDirectory(), false); return status != null ? status.getRevision().toString() : null; }
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
public void updateAuthentication(String login, String password) { authManager = SVNWCUtil.createDefaultAuthenticationManager(login, password); manager = SVNClientManager.newInstance(svnOption, authManager); }
private void setSVNClientManager(AbstractLicenseMojo mojo, String svnServerID) { SVNClientManager c = svnClientThreadLocal.get(); if (c == null) { Credentials svnCredentials = mojo.findCredentials(svnServerID); if (svnCredentials == null) { c = SVNClientManager.newInstance(new DefaultSVNOptions()); } else { c = SVNClientManager.newInstance(new DefaultSVNOptions(), svnCredentials.getLogin(), svnCredentials.getPassword()); } svnClientThreadLocal.set(c); } }
public SVNClientManager createClientManager() { SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, createClientAuthenticationManager()); clientManager.setEventHandler(new ISVNEventHandler() { public void handleEvent(SVNEvent event, double progress) throws SVNException { } public void checkCancelled() throws SVNCancelException { AbstractSVNCommandEnvironment.this.checkCancelled(); } }); return clientManager; }
public SvnRoot(SvnFilesystem filesystem, SVNRepository repository) { this.filesystem = filesystem; this.repository = repository; this.clientManager = SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true), repository.getAuthenticationManager()); this.comment = "sushi commit"; }
public SVNClientManager createClientManager() { SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, createClientAuthenticationManager()); clientManager.setEventHandler(new ISVNEventHandler() { public void handleEvent(SVNEvent event, double progress) throws SVNException { } public void checkCancelled() throws SVNCancelException { AbstractSVNCommandEnvironment.this.checkCancelled(); } }); return clientManager; }
public static void main(String[] args) { ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("admin", "john"); SVNClientManager manager = SVNClientManager.newInstance(); manager.setAuthenticationManager(authManager); SVNCommitClient commitClient = SVNClientManager.newInstance().getCommitClient(); try { SVNCommitInfo info = commitClient.doMkDir(new SVNURL[] { SVNURL.parseURIEncoded("http://192.168.3.127/repository/koux/branches") }, "commitMessage", null, true); long newRevision = info.getNewRevision(); System.out.println(newRevision); } catch (SVNException e) { e.printStackTrace(); } }
public static void main(String[] args) { ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("admin", "john"); SVNClientManager manager = SVNClientManager.newInstance(); manager.setAuthenticationManager(authManager); SVNCommitClient commitClient = SVNClientManager.newInstance().getCommitClient(); try { SVNCommitInfo info = commitClient.doMkDir(new SVNURL[] { SVNURL.parseURIEncoded("http://192.168.3.127/repository/koux/trunk") }, "commitMessage", null, true); long newRevision = info.getNewRevision(); System.out.println(newRevision); } catch (SVNException e) { e.printStackTrace(); } }
public SVNClientManager getClientManager() { if (myClientManager == null) { updateClientManager(); myClientManager = SVNClientManager.newInstance(myOptions, new DefaultSVNRepositoryPool(myAuthenticationManager, myOptions)); myClientManager.setEventHandler(getEventListener()); } return myClientManager; }
public static String urlFromWorkspace(FileNode workspace) throws IOException { SVNClientManager clientManager; clientManager = SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true)); try { return clientManager.getWCClient().doInfo(workspace.toPath().toFile(), SVNRevision.UNDEFINED).getURL().toString(); } catch (SVNException e) { throw new IOException("cannot determine workspace url: " + e.getMessage(), e); } finally { clientManager.dispose(); } } }
public SvnRoot(SvnFilesystem filesystem, SVNRepository repository) { this.filesystem = filesystem; this.repository = repository; this.clientManager = SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true), repository.getAuthenticationManager()); this.comment = "sushi commit"; filesystem.getWorld().onShutdown().onShutdown(this); }
public SVNClientManager getClientManager() { ISVNOptions options = SVNWCUtil.createDefaultOptions( true ); String configDirectory = SvnUtil.getSettings().getConfigDirectory(); ISVNAuthenticationManager isvnAuthenticationManager = SVNWCUtil.createDefaultAuthenticationManager( configDirectory == null ? null : new File( configDirectory ), getUser(), getPassword(), SvnUtil.getSettings().isUseAuthCache() ); SVNClientManager svnClientManager = SVNClientManager.newInstance( options, isvnAuthenticationManager ); return svnClientManager; }
protected SVNClientManager getClientManager() { if (myClientManager == null) { updateClientManager(); myClientManager = SVNClientManager.newInstance(myOptions, new DefaultSVNRepositoryPool(myAuthenticationManager, myOptions)); myClientManager.setDebugLog(getDebugLog()); myClientManager.setEventHandler(getEventListener()); } return myClientManager; }
protected SVNClientManager getClientManager() { if (myClientManager == null) { updateClientManager(); myClientManager = SVNClientManager.newInstance(myOptions, new DefaultSVNRepositoryPool(myAuthenticationManager, myOptions)); myClientManager.setDebugLog(getDebugLog()); myClientManager.setEventHandler(getEventListener()); } return myClientManager; }
protected SVNClientManager getClientManager() { if (myClientManager == null) { updateClientManager(); myClientManager = SVNClientManager.newInstance(myOptions, new DefaultSVNRepositoryPool(myAuthenticationManager, myOptions)); myClientManager.setDebugLog(getDebugLog()); myClientManager.setEventHandler(getEventListener()); } return myClientManager; }
@Before public void setUp() throws Exception { File repo = new CopyExisting(DefaultSVNLogFilter.class.getResource("JENKINS-10449.zip")).allocate(); SVNURL svnUrl = SVNURL.fromFile(repo); SVNClientManager svnMgr = SVNClientManager.newInstance(); svnRepo = svnMgr.createRepository(svnUrl, false); }
/** * Gets the repository revision just committed. */ public long revision() throws Exception { // .getLookClient().doGetYoungestRevision(repo) would show last committed revision but would not be sensitive to checked-out branch; which is clearer? return SVNClientManager.newInstance().getStatusClient().doStatus(wc, true).getRemoteRevision().getNumber(); // http://stackoverflow.com/a/2295674/12916 }
private int checkoutWithFormat(int format) throws Exception { super.configureSvnWorkspaceFormat(format); FreeStyleProject project = r.jenkins.createProject(FreeStyleProject.class, "svntest" + format); SubversionSCM subversionSCM = new SubversionSCM("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant"); project.setScm(subversionSCM); r.assertBuildStatusSuccess(project.scheduleBuild2(0)); // Create a status client and get the working copy format. SVNClientManager testWCVerseion = SVNClientManager.newInstance(null, "testWCVerseion", null); File path = new File(project.getWorkspace().getRemote()); return testWCVerseion.getStatusClient().doStatus(path, true).getWorkingCopyFormat(); } }