SVNCopySource cs = new SVNCopySource(SVNRevision.UNDEFINED,srcRevision,srcURL); return doCopy( new SVNCopySource[]{cs}, dstURL, isMove, true, failWhenDstExists, commitMessage, null);
copySource = null; } else if (SVNPathUtil.isURL(path)) { copySource = new SVNCopySource(pegRevision, revision, SVNURL.parseURIEncoded(path)); } else { copySource = new SVNCopySource(pegRevision, revision, new File(path));
private SVNCopySource[] getCopySources(String[] srcPaths, boolean copyAsChild) throws ClientException { if (srcPaths.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcPaths.length]; try { for (int i = 0; i < srcPaths.length; i++) { if (isURL(srcPaths[i])) { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNURL.parseURIEncoded(srcPaths[i])); } else { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, new File(srcPaths[i]).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
private SVNCopySource[] getCopySources(String[] srcPaths, boolean copyAsChild) throws ClientException { if (srcPaths.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcPaths.length]; try { for (int i = 0; i < srcPaths.length; i++) { if (isURL(srcPaths[i])) { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNURL.parseURIEncoded(srcPaths[i])); } else { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, new File(srcPaths[i]).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
private SVNCopySource[] getCopySources(String[] srcPaths, boolean copyAsChild) throws ClientException { if (srcPaths.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcPaths.length]; try { for (int i = 0; i < srcPaths.length; i++) { if (isURL(srcPaths[i])) { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNURL.parseURIEncoded(srcPaths[i])); } else { sources[i] = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.HEAD, new File(srcPaths[i]).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
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()); } } }
SVNCopySource csrc = new SVNCopySource(sourceRevision, sourceRevision, src); svncc.doCopy( new SVNCopySource[]{csrc},
protected SVNCopySource[] expandCopySources(SVNCopySource[] sources) throws SVNException { Collection expanded = new ArrayList(sources.length); for (int i = 0; i < sources.length; i++) { SVNCopySource source = sources[i]; if (source.isCopyContents() && source.isURL()) { // get children at revision. SVNRevision pegRevision = source.getPegRevision(); if (!pegRevision.isValid()) { pegRevision = SVNRevision.HEAD; } SVNRevision startRevision = source.getRevision(); if (!startRevision.isValid()) { startRevision = pegRevision; } SVNRepositoryLocation[] locations = getLocations(source.getURL(), null, null, pegRevision, startRevision, SVNRevision.UNDEFINED); SVNRepository repository = createRepository(locations[0].getURL(), null, null, true); long revision = locations[0].getRevisionNumber(); Collection entries = new ArrayList(); repository.getDir("", revision, null, 0, entries); for (Iterator ents = entries.iterator(); ents.hasNext();) { SVNDirEntry entry = (SVNDirEntry) ents.next(); // add new copy source. expanded.add(new SVNCopySource(SVNRevision.UNDEFINED, source.getRevision(), entry.getURL())); } } else { expanded.add(source); } } return (SVNCopySource[]) expanded.toArray(new SVNCopySource[expanded.size()]); }
SVNRevision sourceRevision = SVNRevision.create(e .getKey().revision); SVNCopySource csrc = new SVNCopySource( sourceRevision, sourceRevision, src); svncc.doCopy(new SVNCopySource[] { csrc }, dst,
protected SVNCopySource[] expandCopySources(SVNCopySource[] sources) throws SVNException { Collection expanded = new ArrayList(sources.length); for (int i = 0; i < sources.length; i++) { SVNCopySource source = sources[i]; if (source.isCopyContents() && source.isURL()) { // get children at revision. SVNRevision pegRevision = source.getPegRevision(); if (!pegRevision.isValid()) { pegRevision = SVNRevision.HEAD; } SVNRevision startRevision = source.getRevision(); if (!startRevision.isValid()) { startRevision = pegRevision; } SVNRepositoryLocation[] locations = getLocations(source.getURL(), null, null, pegRevision, startRevision, SVNRevision.UNDEFINED); SVNRepository repository = createRepository(locations[0].getURL(), null, null, true); long revision = locations[0].getRevisionNumber(); Collection entries = new ArrayList(); repository.getDir("", revision, null, 0, entries); for (Iterator ents = entries.iterator(); ents.hasNext();) { SVNDirEntry entry = (SVNDirEntry) ents.next(); // add new copy source. expanded.add(new SVNCopySource(SVNRevision.UNDEFINED, source.getRevision(), entry.getURL())); } } else { expanded.add(source); } } return (SVNCopySource[]) expanded.toArray(new SVNCopySource[expanded.size()]); }
protected SVNCopySource[] expandCopySources(SVNCopySource[] sources) throws SVNException { Collection expanded = new ArrayList(sources.length); for (int i = 0; i < sources.length; i++) { SVNCopySource source = sources[i]; if (source.isCopyContents() && source.isURL()) { // get children at revision. SVNRevision pegRevision = source.getPegRevision(); if (!pegRevision.isValid()) { pegRevision = SVNRevision.HEAD; } SVNRevision startRevision = source.getRevision(); if (!startRevision.isValid()) { startRevision = pegRevision; } SVNRepositoryLocation[] locations = getLocations(source.getURL(), null, null, pegRevision, startRevision, SVNRevision.UNDEFINED); SVNRepository repository = createRepository(locations[0].getURL(), null, null, true); long revision = locations[0].getRevisionNumber(); Collection entries = new ArrayList(); repository.getDir("", revision, null, 0, entries); for (Iterator ents = entries.iterator(); ents.hasNext();) { SVNDirEntry entry = (SVNDirEntry) ents.next(); // add new copy source. expanded.add(new SVNCopySource(SVNRevision.UNDEFINED, source.getRevision(), entry.getURL())); } } else { expanded.add(source); } } return (SVNCopySource[]) expanded.toArray(new SVNCopySource[expanded.size()]); }
SVNCopySource csrc = new SVNCopySource(sourceRevision, sourceRevision, src); svncc.doCopy( new SVNCopySource[]{csrc},
private SVNCopySource[] getCopySources(CopySource[] srcs, boolean copyAsChild) throws ClientException { if (srcs.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcs.length]; try { for (int i = 0; i < srcs.length; i++) { if (isURL(srcs[i].getPath())) { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), SVNURL.parseURIEncoded(srcs[i].getPath())); } else { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), new File(srcs[i].getPath()).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
public static SVNCopySource copySource(SvnCopySource newSource) { if (newSource.getSource().getURL() != null) { final SVNCopySource copySource = new SVNCopySource(newSource.getSource().getResolvedPegRevision(), newSource.getRevision(), newSource.getSource().getURL()); copySource.setCopyContents(newSource.isCopyContents()); return copySource; } final SVNCopySource copySource = new SVNCopySource(newSource.getSource().getResolvedPegRevision(), newSource.getRevision(), newSource.getSource().getFile()); copySource.setCopyContents(newSource.isCopyContents()); return copySource; }
private SVNCopySource[] getCopySources(CopySource[] srcs, boolean copyAsChild) throws ClientException { if (srcs.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcs.length]; try { for (int i = 0; i < srcs.length; i++) { if (isURL(srcs[i].getPath())) { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), SVNURL.parseURIEncoded(srcs[i].getPath())); } else { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), new File(srcs[i].getPath()).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
private SVNCopySource[] getCopySources(CopySource[] srcs, boolean copyAsChild) throws ClientException { if (srcs.length > 1 && !copyAsChild) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNException ex = new SVNException(err); throwException(ex); } SVNCopySource[] sources = new SVNCopySource[srcs.length]; try { for (int i = 0; i < srcs.length; i++) { if (isURL(srcs[i].getPath())) { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), SVNURL.parseURIEncoded(srcs[i].getPath())); } else { sources[i] = new SVNCopySource(JavaHLObjectFactory.getSVNRevision(srcs[i].getPegRevision()), JavaHLObjectFactory.getSVNRevision(srcs[i].getRevision()), new File(srcs[i].getPath()).getAbsoluteFile()); } } } catch (SVNException e) { throwException(e); } finally { resetLog(); } return sources; }
SVNPath source = new SVNPath(targetName); if (source.isURL()) { sources.add(new SVNCopySource(SVNRevision.HEAD, SVNRevision.UNDEFINED, source.getURL())); } else { sources.add(new SVNCopySource(getSVNEnvironment().getStartRevision(), SVNRevision.UNDEFINED, source.getFile()));
private SVNCopySource processCopySource(SVNCopySource copySource, long targetRevision) throws SVNException { if (copySource == null) { return null; } if (copySource.isURL() && (copySource.getRevision() != null && copySource.getRevision().getID() == 10)) { return copySource; } SVNRevision pegRevision; SVNRevision revision; try { pegRevision = processCopySourceRevision(copySource.getPegRevision(), copySource, targetRevision); revision = processCopySourceRevision(copySource.getRevision(), copySource, targetRevision); } catch (SVNException e) { SVNDebugLog.getDefaultLog().logFine(SVNLogType.WC, "merge ext: Error while fetching copy source revision"); return null; } SVNURL url = copySource.getURL(); if (url == null) { url = getCopySourceURL(copySource); if (url == null) { return null; } } return new SVNCopySource(pegRevision, revision, url); }