/** * Copies/moves a source URL to a destination one immediately committing changes * to a repository. Equivalent to <code>doCopy(srcURL, srcRevision, dstURL, isMove, false, commitMessage)</code>. * * @param srcURL a source repository location URL * @param srcRevision a revision of <code>srcURL</code> * @param dstURL a target URL where <code>srcURL</code> is to be * copied/moved * @param isMove <span class="javakeyword">true</span> to move the source * to the target (only URL-to-URL), * <span class="javakeyword">false</span> to copy * @param commitMessage a commit log message * @return information on the committed revision * @throws SVNException * @see #doCopy(SVNURL, SVNRevision, SVNURL, boolean, boolean, String) */ public SVNCommitInfo doCopy(SVNURL srcURL, SVNRevision srcRevision, SVNURL dstURL, boolean isMove, String commitMessage) throws SVNException { return doCopy(srcURL, srcRevision, dstURL, isMove, false, commitMessage); }
private void copyOrMove(SVNCopySource[] sources, String destPath, boolean isMove, String message, boolean copyAsChild, boolean makeParents, Map revprops) throws ClientException { SVNCopyClient client = getSVNCopyClient(); try { if (isURL(destPath)) { SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops); boolean isURLs = sources.length > 0 && sources[0].isURL(); client.setCommitHandler(createCommitMessageHandler(isURLs)); client.doCopy(sources, SVNURL.parseURIEncoded(destPath), isMove, makeParents, !copyAsChild, message, revisionProperties); } else { client.doCopy(sources, new File(destPath).getAbsoluteFile(), isMove, makeParents, !copyAsChild); } } catch (SVNException e) { throwException(e); } finally { if (client != null) { client.setCommitHandler(null); } resetLog(); } }
/** * Returns an instance of the {@link SVNCopyClient} 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>SVNCopyClient</b> instance */ public SVNCopyClient getCopyClient() { if (myCopyClient == null) { myCopyClient = new SVNCopyClient(this, myOptions); myCopyClient.setEventHandler(myEventHandler); myCopyClient.setDebugLog(getDebugLog()); myCopyClient.setIgnoreExternals(myIsIgnoreExternals); } return myCopyClient; }
protected void initDefaults() { setCommitParameters(null); setCommitHandler(null); setExternalsHandler(null); }
/** * Returns an instance of the {@link SVNCopyClient} 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>SVNCopyClient</b> instance */ public SVNCopyClient getCopyClient() { if (myCopyClient == null) { myCopyClient = new SVNCopyClient(this, myOptions); myCopyClient.setEventHandler(myEventHandler); myCopyClient.setDebugLog(getDebugLog()); } return myCopyClient; }
if (!sourceIsURL && !dst.isURL()) { if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); client.setEventHandler(printer); } else if (sourceIsURL && !dst.isURL()) { if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment(), true, false, false)); client.setCommitHandler(getSVNEnvironment()); SVNCopySource[] copySources = (SVNCopySource[]) sources.toArray(new SVNCopySource[sources.size()]); if (dst.isURL()) { SVNCommitInfo info = client.doCopy(copySources, dst.getURL(), false, getSVNEnvironment().isParents(), false, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isPinExternals(), null); client.doCopy(copySources, dst.getFile(), false, getSVNEnvironment().isParents(), false, getSVNEnvironment().isPinExternals(), null);
SVNErrorManager.error(err, SVNLogType.DEFAULT); sources = expandCopySources(sources); if (sources.length == 0) { return; setupCopy(sources, new SVNPath(dst.getAbsolutePath(), false, false), isMove, makeParents, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException e) { SVNErrorCode err = e.getErrorMessage().getErrorCode(); setupCopy(sources, new SVNPath(new File(dst, baseName).getAbsolutePath(), false, false), isMove, makeParents, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException second) { throw second;
SVNWCAccess wcAccess = createWCAccess(); wcAccess.probeOpen(srcPath, false, 0); SVNEntry srcEntry = wcAccess.getEntry(srcPath, false); return doCopy(srcEntry.getSVNURL(), srcRevision, dstURL, false, failWhenDstExists, commitMessage); SVNWCAccess wcAccess = createWCAccess(); SVNAdminArea adminArea = wcAccess.probeOpen(srcPath, false, SVNWCAccess.INFINITE_DEPTH); wcAccess.setAnchor(adminArea.getRoot()); SVNRepository repository = createRepository(dstAnchorURL, true); SVNNodeKind dstKind = repository.checkPath(dstTarget, -1); if (dstKind == SVNNodeKind.DIR) { }; items[0].setWCAccess(adminArea.getWCAccess()); commitMessage = getCommitHandler().getCommitMessage(commitMessage, items); if (commitMessage == null) { return SVNCommitInfo.NULL; true, false, false, null, true, false, getCommitParameters()); items = (SVNCommitItem[]) commitables.values().toArray(new SVNCommitItem[commitables.values().size()]); for (int i = 0; i < items.length; i++) { repository = createRepository(dstURL, true); SVNCommitMediator mediator = new SVNCommitMediator(commitables); tmpFiles = mediator.getTmpFiles(); dispatchEvent(SVNEventFactory.createCommitCompletedEvent(null, info.getNewRevision()), ISVNEventHandler.UNKNOWN);
SVNCopyClient copyClient = new SVNCopyClient(connection.getManager(), connection.getSvnOption()); copyClient.doCopy(sourceFileTab, destUrl, true, false, true, "From scmwebeditor -- move the file : " + sourceUrl.getPath() + " to : " + destUrl.getPath(), null); } catch (SVNAuthenticationException authexep) {
if (srcRevision.isValid() && srcRevision != SVNRevision.WORKING && !isMove) { SVNWCAccess wcAccess = createWCAccess(); SVNURL srcURL = null; try { wcAccess.close(); doCopy(srcURL, srcRevision, dstPath); return; SVNWCAccess wcAccess = createWCAccess(); SVNAdminArea adminArea = null; File srcParent = srcPath.getParentFile(); SVNWCManager.canDelete(srcPath, false, getOptions()); } catch (SVNException svne) { SVNErrorMessage err = svne.getErrorMessage().wrap("Move will not be attempted unless forced"); SVNWCAccess copyAccess = createWCAccess(); try { SVNAdminArea srcArea = copyAccess.probeOpen(srcPath, false, SVNWCAccess.INFINITE_DEPTH); copyFile(adminArea, srcArea, srcPath, dstPath.getName()); } else if (srcType == SVNFileType.DIRECTORY) { copyDir(adminArea, srcArea, srcPath, dstPath.getName());
public SVNCommitInfo doCopy(SVNCopySource[] sources, SVNURL dst, boolean isMove, boolean makeParents, boolean failWhenDstExists, String commitMessage, SVNProperties revisionProperties, boolean pinExternals, Map<SvnTarget, List<SVNExternal>> externalsToPin) throws SVNException { SvnRemoteCopy cp = getOperationsFactory().createRemoteCopy(); cp.setSingleTarget(SvnTarget.fromURL(dst)); cp.setMove(isMove); cp.setFailWhenDstExists(failWhenDstExists); cp.setMakeParents(makeParents); cp.setCommitMessage(commitMessage); cp.setRevisionProperties(revisionProperties); cp.setExternalsHandler(SvnCodec.externalsHandler(getExternalsHandler())); cp.setCommitHandler(SvnCodec.commitHandler(getCommitHandler())); cp.setDisableLocalModifications(disableLocalModifications); cp.setCommitParameters(SvnCodec.commitParameters(getCommitParameters())); cp.setPinExternals(pinExternals); cp.setExternalsToPin(externalsToPin); for (int i = 0; i < sources.length; i++) { cp.addCopySource(SvnCodec.copySource(sources[i])); } return cp.run(); }
public void setEventHandler(ISVNEventHandler dispatcher) { super.setEventHandler(dispatcher); myWCClient.setEventHandler(dispatcher); myCopyClient.setEventHandler(dispatcher); }
/** * Returns an instance of the {@link SVNCopyClient} 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>SVNCopyClient</b> instance */ public SVNCopyClient getCopyClient() { if (myCopyClient == null) { myCopyClient = myOperationFactory != null ? new SVNCopyClient(myOperationFactory) : new SVNCopyClient(this, myOptions); initClientDefaults(myCopyClient); } return myCopyClient; }
public void setDebugLog(ISVNDebugLog log) { super.setDebugLog(log); myWCClient.setDebugLog(log); myCopyClient.setDebugLog(log); }
SVNRepository repository = createRepository(topURL, true); if (!dstURL.equals(repository.getRepositoryRoot(true)) && srcURL.getPath().startsWith(dstURL.getPath() + "/")) { isResurrect = true; topURL = topURL.removePathTail(); repository = createRepository(topURL, true); long srcRevNumber = getRevisionNumber(srcRevision, repository, null); long latestRevision = repository.getLatestRevision(); false, true, false, false, false, false)); commitMessage = getCommitHandler().getCommitMessage(commitMessage, (SVNCommitItem[]) commitItems.toArray(new SVNCommitItem[commitItems.size()])); if (commitMessage == null) { return SVNCommitInfo.NULL; dispatchEvent(SVNEventFactory.createCommitCompletedEvent(null, result.getNewRevision()), ISVNEventHandler.UNKNOWN);
if (!sourceIsURL && !dst.isURL()) { if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment())); client.setEventHandler(printer); } else if (sourceIsURL && !dst.isURL()) { if (!getSVNEnvironment().isQuiet()) { client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment(), true, false, false)); client.setCommitHandler(getSVNEnvironment()); SVNCopySource[] copySources = (SVNCopySource[]) sources.toArray(new SVNCopySource[sources.size()]); if (dst.isURL()) { SVNCommitInfo info = client.doCopy(copySources, dst.getURL(), false, getSVNEnvironment().isParents(), false, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isPinExternals(), null); client.doCopy(copySources, dst.getFile(), false, getSVNEnvironment().isParents(), false, getSVNEnvironment().isPinExternals(), null);
SVNErrorManager.error(err, SVNLogType.DEFAULT); sources = expandCopySources(sources); if (sources.length == 0) { return; setupCopy(sources, new SVNPath(dst.getAbsolutePath()), isMove, makeParents, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException e) { SVNErrorCode err = e.getErrorMessage().getErrorCode(); setupCopy(sources, new SVNPath(new File(dst, baseName).getAbsolutePath()), isMove, makeParents, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException second) { throw second;
SvnRemoteCopy cp = getOperationsFactory().createRemoteCopy(); cp.setSingleTarget(SvnTarget.fromURL(dst)); cp.setMove(isMove); cp.setCommitMessage(commitMessage); cp.setRevisionProperties(revisionProperties); cp.setExternalsHandler(SvnCodec.externalsHandler(getExternalsHandler())); cp.setCommitHandler(SvnCodec.commitHandler(getCommitHandler())); cp.setDisableLocalModifications(disableLocalModifications); cp.setCommitParameters(SvnCodec.commitParameters(getCommitParameters()));
public void setEventHandler(ISVNEventHandler dispatcher) { super.setEventHandler(dispatcher); myWCClient.setEventHandler(dispatcher); myCopyClient.setEventHandler(dispatcher); }
/** * 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); }