protected SVNMoveClient(ISVNRepositoryPool repositoryPool, ISVNOptions options) { super(repositoryPool, options); myWCClient = new SVNWCClient(repositoryPool, options); }
/** * Constructs and initializes an <b>SVNMoveClient</b> object * with the specified run-time configuration and authentication * drivers. * * <p> * If <code>options</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default run-time * configuration driver which takes client-side settings from the * default SVN's run-time configuration area but is not able to * change those settings (read more on {@link ISVNOptions} and {@link SVNWCUtil}). * * <p> * If <code>authManager</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default authentication * and network layers driver (see {@link SVNWCUtil#createDefaultAuthenticationManager()}) * which uses server-side settings and auth storage from the * default SVN's run-time configuration area (or system properties * if that area is not found). * * @param authManager an authentication and network layers driver * @param options a run-time configuration options driver */ public SVNMoveClient(ISVNAuthenticationManager authManager, ISVNOptions options) { super(authManager, options); myWCClient = new SVNWCClient(authManager, options); }
/** * Returns an instance of the {@link SVNWCClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNWCClient</b> instance */ public SVNWCClient getWCClient() { if (myWCClient == null) { myWCClient = myOperationFactory != null ? new SVNWCClient(myOperationFactory) : new SVNWCClient(this, myOptions); initClientDefaults(myWCClient); } return myWCClient; }
/** * Constructs and initializes an <b>SVNMoveClient</b> object * with the specified run-time configuration and repository pool object. * * <p/> * If <code>options</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default run-time * configuration driver which takes client-side settings from the * default SVN's run-time configuration area but is not able to * change those settings (read more on {@link ISVNOptions} and {@link SVNWCUtil}). * * <p/> * If <code>repositoryPool</code> is <span class="javakeyword">null</span>, * then {@link org.tmatesoft.svn.core.io.SVNRepositoryFactory} will be used to create {@link SVNRepository repository access objects}. * * @param repositoryPool a repository pool object * @param options a run-time configuration options driver */ public SVNMoveClient(ISVNRepositoryPool repositoryPool, ISVNOptions options) { super(repositoryPool, options); myWCClient = new SVNWCClient(repositoryPool, options); myCopyClient = new SVNCopyClient(repositoryPool, options); }
/** * Constructs and initializes an <b>SVNMoveClient</b> object * with the specified run-time configuration and repository pool object. * * <p/> * If <code>options</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default run-time * configuration driver which takes client-side settings from the * default SVN's run-time configuration area but is not able to * change those settings (read more on {@link ISVNOptions} and {@link SVNWCUtil}). * * <p/> * If <code>repositoryPool</code> is <span class="javakeyword">null</span>, * then {@link org.tmatesoft.svn.core.io.SVNRepositoryFactory} will be used to create {@link SVNRepository repository access objects}. * * @param repositoryPool a repository pool object * @param options a run-time configuration options driver */ public SVNMoveClient(ISVNRepositoryPool repositoryPool, ISVNOptions options) { super(repositoryPool, options); myWCClient = new SVNWCClient(repositoryPool, options); myCopyClient = new SVNCopyClient(repositoryPool, options); }
/** * Constructs and initializes an <b>SVNMoveClient</b> object * with the specified run-time configuration and authentication * drivers. * * <p> * If <code>options</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default run-time * configuration driver which takes client-side settings from the * default SVN's run-time configuration area but is not able to * change those settings (read more on {@link ISVNOptions} and {@link SVNWCUtil}). * * <p> * If <code>authManager</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default authentication * and network layers driver (see {@link SVNWCUtil#createDefaultAuthenticationManager()}) * which uses server-side settings and auth storage from the * default SVN's run-time configuration area (or system properties * if that area is not found). * * @param authManager an authentication and network layers driver * @param options a run-time configuration options driver */ public SVNMoveClient(ISVNAuthenticationManager authManager, ISVNOptions options) { super(authManager, options); myWCClient = new SVNWCClient(authManager, options); myCopyClient = new SVNCopyClient(authManager, options); }
/** * Constructs and initializes an <b>SVNMoveClient</b> object * with the specified run-time configuration and authentication * drivers. * * <p> * If <code>options</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default run-time * configuration driver which takes client-side settings from the * default SVN's run-time configuration area but is not able to * change those settings (read more on {@link ISVNOptions} and {@link SVNWCUtil}). * * <p> * If <code>authManager</code> is <span class="javakeyword">null</span>, * then this <b>SVNMoveClient</b> will be using a default authentication * and network layers driver (see {@link SVNWCUtil#createDefaultAuthenticationManager()}) * which uses server-side settings and auth storage from the * default SVN's run-time configuration area (or system properties * if that area is not found). * * @param authManager an authentication and network layers driver * @param options a run-time configuration options driver */ public SVNMoveClient(ISVNAuthenticationManager authManager, ISVNOptions options) { super(authManager, options); myWCClient = new SVNWCClient(authManager, options); myCopyClient = new SVNCopyClient(authManager, options); }
private void addLocalParents(File path, ISVNEventHandler handler) throws SVNException { boolean created = path.mkdirs(); SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, null); try { wcClient.setEventHandler(handler); wcClient.doAdd(path, false, false, true, SVNDepth.EMPTY, true, true); } catch (SVNException e) { if (created) { SVNFileUtil.deleteAll(path, true); } throw e; } }
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { log(listener, "Cleanup working copy: " + workingCopy); ISVNAuthenticationManager sam = SVNWCUtil.createDefaultAuthenticationManager(); sam.setAuthenticationProvider(authProvider); SVNWCClient wcClient = new SVNWCClient(sam, null); wcClient.doCleanup(workingCopy); return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed Cleanup ", e); throw new IOException(e.getMessage()); } } }
private void addLocalParents(File path, ISVNEventHandler handler) throws SVNException { boolean created = path.mkdirs(); SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, null); try { wcClient.setEventHandler(handler); wcClient.doAdd(path, false, false, true, SVNDepth.EMPTY, true, true); } catch (SVNException e) { if (created) { SVNFileUtil.deleteAll(path, true); } throw e; } }
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { log(listener, "Reverting working copy: " + workingCopy); ISVNAuthenticationManager sam = SVNWCUtil.createDefaultAuthenticationManager(); sam.setAuthenticationProvider(authProvider); SVNWCClient wcClient = new SVNWCClient(sam, null); wcClient.doRevert(new File[]{workingCopy}, SVNDepth.INFINITY, null); return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed Revert WorkingCopy ", e); throw new IOException(e.getMessage()); } } }
/** * Returns an instance of the {@link SVNWCClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNWCClient</b> instance */ public SVNWCClient getWCClient() { if (myWCClient == null) { myWCClient = new SVNWCClient(this, myOptions); myWCClient.setEventHandler(myEventHandler); myWCClient.setDebugLog(getDebugLog()); } return myWCClient; }
@Override public String getHeadRevisionNumber(String path, String username, String password) throws AuthenticationException { if (log.isDebugEnabled()) { log.debug("headRevisionNumber expected " + addressSvn + " ; got " + path); } ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(username, password); DefaultSVNOptions svnOptions = new DefaultSVNOptions(); svnOptions.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); SVNWCClient wcClient = new SVNWCClient(svnAuthManager, svnOptions); SVNInfo info = null; try { info = wcClient.doInfo(SVNURL.parseURIEncoded(path), SVNRevision.HEAD, SVNRevision.HEAD); } catch (SVNAuthenticationException e) { throw new AuthenticationException("Auth fail"); } catch (SVNException e) { if (log.isErrorEnabled()) { log.error("Can not get info from SVN repository", e); } } String headRevision = ""; if (info != null) { headRevision = info.getRevision().toString(); } return headRevision; }
/** * Returns an instance of the {@link SVNWCClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNWCClient</b> instance */ public SVNWCClient getWCClient() { if (myWCClient == null) { myWCClient = new SVNWCClient(this, myOptions); myWCClient.setEventHandler(myEventHandler); myWCClient.setDebugLog(getDebugLog()); myWCClient.setIgnoreExternals(myIsIgnoreExternals); } return myWCClient; }
/** * Returns an instance of the {@link SVNWCClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNWCClient</b> instance */ public SVNWCClient getWCClient() { if (myWCClient == null) { myWCClient = new SVNWCClient(this, myOptions); myWCClient.setEventHandler(myEventHandler); myWCClient.setDebugLog(getDebugLog()); myWCClient.setIgnoreExternals(myIsIgnoreExternals); } return myWCClient; }
/** * Gives the name of the person who made the last commit * @param address the repository's address * @param login the username to use to connect to the repository * @param password the password to use to connect to the repository * @return the name of the person who made the last commit * @throws SVNException if there is a problem while accessing the repository */ public String getHeadcommiter(String address, String login, String password) throws SVNException { ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(login, password); DefaultSVNOptions svnOptions = new DefaultSVNOptions(); svnOptions.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); SVNWCClient wcClient = new SVNWCClient(svnAuthManager, svnOptions); SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD); String headAuthor = info.getAuthor(); return headAuthor; }
private void copyDisjointDir(File nestedWC, SVNWCAccess parentAccess, File nestedWCParent) throws SVNException { SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, null); wcClient.setEventHandler(getEventDispatcher()); wcClient.doCleanup(nestedWC); SVNWCAccess nestedWCAccess = createWCAccess(); SVNAdminArea dir; String copyFromURL = null; long copyFromRevision = -1; try { dir = nestedWCAccess.open(nestedWC, true, SVNWCAccess.INFINITE_DEPTH); SVNEntry nestedWCThisEntry = nestedWCAccess.getVersionedEntry(nestedWC, false); postCopyCleanup(dir); if (nestedWCThisEntry.isCopied()) { if (nestedWCThisEntry.getCopyFromURL() != null) { copyFromURL = nestedWCThisEntry.getCopyFromURL(); copyFromRevision = nestedWCThisEntry.getCopyFromRevision(); } Map attributes = new SVNHashMap(); attributes.put(SVNProperty.URL, copyFromURL); dir.modifyEntry(dir.getThisDirName(), attributes, true, false); } else { copyFromURL = nestedWCThisEntry.getURL(); copyFromRevision = nestedWCThisEntry.getRevision(); } } finally { nestedWCAccess.close(); } SVNWCManager.add(nestedWC, parentAccess.getAdminArea(nestedWCParent), SVNURL.parseURIEncoded(copyFromURL), copyFromRevision, SVNDepth.INFINITY); }
private void copyDisjointDir(File nestedWC, SVNWCAccess parentAccess, File nestedWCParent) throws SVNException { SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, null); wcClient.setEventHandler(getEventDispatcher()); wcClient.doCleanup(nestedWC); SVNWCAccess nestedWCAccess = createWCAccess(); SVNAdminArea dir; String copyFromURL = null; long copyFromRevision = -1; try { dir = nestedWCAccess.open(nestedWC, true, SVNWCAccess.INFINITE_DEPTH); SVNEntry nestedWCThisEntry = nestedWCAccess.getVersionedEntry(nestedWC, false); postCopyCleanup(dir); if (nestedWCThisEntry.isCopied()) { if (nestedWCThisEntry.getCopyFromURL() != null) { copyFromURL = nestedWCThisEntry.getCopyFromURL(); copyFromRevision = nestedWCThisEntry.getCopyFromRevision(); } Map attributes = new SVNHashMap(); attributes.put(SVNProperty.URL, copyFromURL); dir.modifyEntry(dir.getThisDirName(), attributes, true, false); } else { copyFromURL = nestedWCThisEntry.getURL(); copyFromRevision = nestedWCThisEntry.getRevision(); } } finally { nestedWCAccess.close(); } SVNWCManager.add(nestedWC, parentAccess.getAdminArea(nestedWCParent), SVNURL.parseURIEncoded(copyFromURL), copyFromRevision, SVNDepth.INFINITY); }
SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, null); wcClient.setEventHandler(getEventDispatcher()); wcClient.doCleanup(dst);
private void copyDir(SVNAdminArea dstParent, SVNAdminArea srcArea, File srcPath, String dstName) throws SVNException { SVNEntry srcEntry = srcArea.getWCAccess().getEntry(srcPath, false); if (srcEntry == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_NOT_FOUND, "'{0}'' is not under version control", srcPath); SVNErrorManager.error(err); } if (srcEntry.isScheduledForAddition() || srcEntry.getURL() == null || srcEntry.isCopied()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Cannot copy or move ''{0}'': it''s not in repository yet; try committing first", srcPath); SVNErrorManager.error(err); } File dstPath = dstParent.getFile(dstName); SVNFileUtil.copyDirectory(srcPath, dstPath, true, srcArea.getWCAccess()); SVNWCClient wcClient = new SVNWCClient((ISVNAuthenticationManager) null, (ISVNOptions) null); wcClient.doCleanup(dstPath); SVNWCAccess tmpAccess = SVNWCAccess.newInstance(null); try { SVNAdminArea tmpDir = tmpAccess.open(dstPath, true, SVNWCAccess.INFINITE_DEPTH); postCopyCleanup(tmpDir); } finally { tmpAccess.close(); } SVNWCManager.add(dstPath, dstParent, srcEntry.getSVNURL(), srcEntry.getRevision()); }