/** * 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); }
/** * Copies a source Working Copy path (or its repository location URL) to a destination * URL immediately committing changes to a repository. * * <p> * Equivalent to <code>doCopy(srcPath, srcRevision, dstURL, false, commitMessage)</code>. * * @param srcPath a source Working Copy path * @param srcRevision a revision of <code>srcPath</code> * @param dstURL a target URL where <code>srcPath</code> is to be * copied * @param commitMessage a commit log message * @return information on the committed revision * @throws SVNException if one of the following is true: * <ul> * <li><code>srcPath</code> is not under version control * <li><code>srcPath</code> has no URL * <li>the repository location of <code>srcPath</code> was not * found in <code>srcRevision</code> * <li><code>dstURL</code> already exists * </ul> * @see #doCopy(File, SVNRevision, SVNURL, boolean, String) */ public SVNCommitInfo doCopy(File srcPath, SVNRevision srcRevision, SVNURL dstURL, String commitMessage) throws SVNException { return doCopy(srcPath, srcRevision, dstURL, false, commitMessage); }
return doCopy( new SVNCopySource[]{cs}, dstURL, isMove, true, failWhenDstExists, commitMessage, null);
public void copy(String srcPath, String destPath, String message, Revision revision) throws ClientException { SVNCopyClient client = getSVNCopyClient(); SVNRevision srcRevision = JavaHLObjectFactory.getSVNRevision(revision); try { if(isURL(srcPath) && isURL(destPath)){ client.doCopy(SVNURL.parseURIEncoded(srcPath), srcRevision, SVNURL.parseURIEncoded(destPath), false, message); } else if (isURL(srcPath) && !isURL(destPath)) { client.doCopy(SVNURL.parseURIEncoded(srcPath), srcRevision, new File(destPath).getAbsoluteFile()); } else if (!isURL(srcPath) && isURL(destPath)) { client.doCopy(new File(srcPath).getAbsoluteFile(), srcRevision, SVNURL.parseURIEncoded(destPath), message); } else if (!isURL(srcPath) && !isURL(destPath)) { client.doCopy(new File(srcPath).getAbsoluteFile(), srcRevision, new File(destPath).getAbsoluteFile(), false, false); } } catch (SVNException e) { throwException(e); } }
public void move(String srcPath, String destPath, String message, Revision revision, boolean force) throws ClientException { SVNCopyClient client = getSVNCopyClient(); SVNRevision srcRevision = JavaHLObjectFactory.getSVNRevision(revision); try { if(isURL(srcPath) && isURL(destPath)){ client.doCopy(SVNURL.parseURIEncoded(srcPath), srcRevision, SVNURL.parseURIEncoded(destPath), true, message); } else if (!isURL(srcPath) && !isURL(destPath)) { client.doCopy(new File(srcPath).getAbsoluteFile(), srcRevision, new File(destPath).getAbsoluteFile(), force, true); } } catch (SVNException e) { throwException(e); } }
public static SVNCommitInfo copy( SVNClientManager clientManager, File srcPath, SVNURL dstURL, boolean isMove, String commitMessage, String revision ) throws SVNException { SVNRevision svnRevision = null; if ( StringUtils.isEmpty( revision ) ) { svnRevision = SVNRevision.WORKING; } else { svnRevision = SVNRevision.create( Long.parseLong( revision ) ); } /* * SVNRevision.WORKING means working (current) revision. * Returns SVNCommitInfo containing information on the new revision committed * (revision number, etc.) */ SVNCopySource[] svnCopySources = new SVNCopySource[1]; svnCopySources[0] = new SVNCopySource( svnRevision, svnRevision, srcPath ); return clientManager.getCopyClient().doCopy( svnCopySources, dstURL, false, true, true, commitMessage, new SVNProperties() ); }
public static SVNCommitInfo copy( SVNClientManager clientManager, SVNURL srcURL, SVNURL dstURL, boolean isMove, String commitMessage, String revision ) throws SVNException { SVNRevision svnRevision = null; if ( StringUtils.isEmpty( revision ) ) { svnRevision = SVNRevision.HEAD; } else { svnRevision = SVNRevision.create( Long.parseLong( revision ) ); } /* * SVNRevision.HEAD means the latest revision. * Returns SVNCommitInfo containing information on the new revision committed * (revision number, etc.) */ SVNCopySource[] svnCopySources = new SVNCopySource[1]; svnCopySources[0] = new SVNCopySource( svnRevision, svnRevision, srcURL ); return clientManager.getCopyClient().doCopy( svnCopySources, dstURL, false, true, true, commitMessage, new SVNProperties() ); //return clientManager.getCopyClient().doCopy( srcURL, svnRevision, dstURL, isMove, commitMessage, new SVNProperties() ); }
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { SVNURL svnUrl = SVNURL.parseURIEncoded(tagUrl); SVNCopyClient copyClient; try { copyClient = SubversionSCM.createClientManager(authProvider).getCopyClient(); } catch (NoSuchMethodError e) { //todo remove when backward compatibility not needed //fallback for older versions of org.jenkins-ci.plugins:subversion buildListener.getLogger().println( "[RELEASE] You are using an old subversion jenkins plugin, please consider upgrading."); copyClient = SubversionSCM.createSvnClientManager(authProvider).getCopyClient(); } buildListener.getLogger().println("[RELEASE] Creating subversion tag: " + tagUrl); SVNCopySource source = new SVNCopySource(SVNRevision.WORKING, SVNRevision.WORKING, workingCopy); SVNCommitInfo commitInfo = copyClient.doCopy(new SVNCopySource[]{source}, svnUrl, false, true, true, commitMessage, new SVNProperties()); SVNErrorMessage errorMessage = commitInfo.getErrorMessage(); if (errorMessage != null) { throw new IOException("Failed to create tag: " + errorMessage.getFullMessage()); } return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed to create tag", e); throw new IOException("Subversion tag creation failed: " + e.getMessage()); } } }
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(); } }
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(); } }
SVNRevision sourceRevision = SVNRevision.create(e.getKey().revision); SVNCopySource csrc = new SVNCopySource(sourceRevision, sourceRevision, src); svncc.doCopy( new SVNCopySource[]{csrc}, dst, false, true, false, comment, null);
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(); } }
SVNCopySource csrc = new SVNCopySource( sourceRevision, sourceRevision, src); svncc.doCopy(new SVNCopySource[] { csrc }, dst, false, true, false, comment, null); } catch (SVNException x) {
SVNRevision sourceRevision = SVNRevision.create(e.getKey().revision); SVNCopySource csrc = new SVNCopySource(sourceRevision, sourceRevision, src); svncc.doCopy( new SVNCopySource[]{csrc}, dst, false, true, false, comment, null);
copyClient.doCopy(new SVNCopySource[]{source}, dstURL, false, false, true, "Create new Branch", null);
copyClient.doCopy(sourceFileTab, destUrl, true, false, true, "From scmwebeditor -- move the file : " + sourceUrl.getPath() + " to : " + destUrl.getPath(), null); } catch (SVNAuthenticationException authexep) {
try { if (dst.isURL()) { SVNCommitInfo info = client.doCopy(copySources, dst.getURL(), true, getSVNEnvironment().isParents(), false, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties()); if (!getSVNEnvironment().isQuiet()) { client.doCopy(copySources, dst.getFile(), true, getSVNEnvironment().isParents(), false, getSVNEnvironment().isAllowMixedRevisions(), false);
try { if (dst.isURL()) { SVNCommitInfo info = client.doCopy(copySources, dst.getURL(), true, getSVNEnvironment().isParents(), false, getSVNEnvironment().getMessage(), getSVNEnvironment().getRevisionProperties()); if (!getSVNEnvironment().isQuiet()) { client.doCopy(copySources, dst.getFile(), true, getSVNEnvironment().isParents(), false, getSVNEnvironment().isAllowMixedRevisions(), false);
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);
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);