/** * Returns the name of this copy source. * @return copy source name */ public String getName() { if (isURL()) { return SVNPathUtil.tail(myURL.getPath()); } return myPath.getName(); }
/** * Returns the name of this copy source. * @return copy source name */ public String getName() { if (isURL()) { return SVNPathUtil.tail(myURL.getPath()); } return myPath.getName(); }
/** * Returns the name of this copy source. * @return copy source name */ public String getName() { if (isURL()) { return SVNPathUtil.tail(myURL.getPath()); } return myPath.getName(); }
private SVNURL getCopySourceURL(SVNCopySource source) throws SVNException { if (source == null) { return null; } if (source.isURL()) { return source.getURL(); } String relativePath = SVNPathUtil.getPathAsChild(myTarget.getAbsolutePath(), source.getFile().getAbsolutePath()); if (relativePath == null) { SVNDebugLog.getDefaultLog().logFine(SVNLogType.WC, "merge ext: illegal file path passed as copy source"); return null; } return myTargetURL.appendPath(relativePath, false); }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("merge task: source from "); buffer.append(getMergeSource()); buffer.append("; source to"); buffer.append(getMergeSource2()); buffer.append("; target "); buffer.append(getMergeTarget()); buffer.append("; revision ranges "); if (getRemainingRanges() == null) { buffer.append("[NULL]"); } else { buffer.append(getRemainingRanges().toString()); } buffer.append("; copy source "); if (getTargetCopySource() != null) { buffer.append(getTargetCopySource().isURL() ? getTargetCopySource().getURL().toString() : getTargetCopySource().getFile().getAbsolutePath()); buffer.append("@"); buffer.append(getTargetCopySource().getPegRevision().toString()); buffer.append(" revision "); buffer.append(getTargetCopySource().getRevision()); } else { buffer.append("[NULL]"); } return buffer.toString(); } }
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()]); }
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()]); }
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(); } }
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 doCopy(SVNCopySource[] sources, File dst, boolean isMove, boolean makeParents, boolean failWhenDstExists, boolean pinExternals, Map<SvnTarget, List<SVNExternal>> externalsToPin) throws SVNException { if (sources.length > 1 && failWhenDstExists) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNErrorManager.error(err, SVNLogType.DEFAULT); } sources = expandCopySources(sources); if (sources.length == 0) { return; } try { setupCopy(sources, new SVNPath(dst.getAbsolutePath(), false, false), isMove, makeParents, pinExternals, externalsToPin, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException e) { SVNErrorCode err = e.getErrorMessage().getErrorCode(); if (!failWhenDstExists && sources.length == 1 && (err == SVNErrorCode.ENTRY_EXISTS || err == SVNErrorCode.FS_ALREADY_EXISTS)) { SVNCopySource source = sources[0]; String baseName = source.getName(); if (source.isURL()) { baseName = SVNEncodingUtil.uriDecode(baseName); } try { setupCopy(sources, new SVNPath(new File(dst, baseName).getAbsolutePath(), false, false), isMove, makeParents, pinExternals, externalsToPin, null, null, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException second) { throw second; } return; } throw e; } }
public static SvnCopySource copySource(SVNCopySource oldSource) { SvnTarget target; if (oldSource.isURL()) { target = SvnTarget.fromURL(oldSource.getURL(), oldSource.getPegRevision()); } else { target = SvnTarget.fromFile(oldSource.getFile(), oldSource.getPegRevision()); } final SvnCopySource copySource = SvnCopySource.create(target, oldSource.getRevision()); copySource.setCopyContents(oldSource.isCopyContents()); return copySource; }
SVNCopySource source = sources[0]; String baseName = source.getName(); if (source.isURL()) { baseName = SVNEncodingUtil.uriDecode(baseName);
SVNCopySource source = sources[0]; String baseName = source.getName(); if (source.isURL()) { baseName = SVNEncodingUtil.uriDecode(baseName);
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); }
private File getCopySourcePath(SVNCopySource source) { if (source == null) { return null; } if (!source.isURL()) { return source.getFile(); } File target = null; String sPath = SVNPathUtil.getPathAsChild(mySourceURL.getPath(), source.getURL().getPath()); String tPath = SVNPathUtil.getPathAsChild(myTargetURL.getPath(), source.getURL().getPath()); if (sPath != null) { target = getFile(sPath); } else if (tPath != null) { target = getFile(tPath); } else { SVNDebugLog.getDefaultLog().logFine(SVNLogType.WC, "merge ext: Neither merge source URL nor merge target URL are not ancestors of copy source URL"); } return target; }
public SVNCommitInfo doCopy(SVNCopySource[] sources, SVNURL dst, boolean isMove, boolean makeParents, boolean failWhenDstExists, boolean pinExternals, Map<SvnTarget, List<SVNExternal>> externalsToPin, String commitMessage, SVNProperties revisionProperties) throws SVNException { if (sources.length > 1 && failWhenDstExists) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED); SVNErrorManager.error(err, SVNLogType.DEFAULT); } sources = expandCopySources(sources); if (sources.length == 0) { return SVNCommitInfo.NULL; } try { return setupCopy(sources, new SVNPath(dst.toString(), false, false), isMove, makeParents, pinExternals, externalsToPin, commitMessage, revisionProperties, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException e) { SVNErrorCode err = e.getErrorMessage().getErrorCode(); if (!failWhenDstExists && sources.length == 1 && (err == SVNErrorCode.ENTRY_EXISTS || err == SVNErrorCode.FS_ALREADY_EXISTS)) { SVNCopySource source = sources[0]; String baseName = source.getName(); if (!source.isURL()) { baseName = SVNEncodingUtil.uriEncode(baseName); } try { return setupCopy(sources, new SVNPath(dst.appendPath(baseName, true).toString(), false, false), isMove, makeParents, pinExternals, externalsToPin, commitMessage, revisionProperties, getCommitHandler(), getCommitParameters(), getExternalsHandler()); } catch (SVNException second) { throw second; } } throw e; } }
SVNCopySource source = sources[0]; String baseName = source.getName(); if (!source.isURL()) { baseName = SVNEncodingUtil.uriEncode(baseName);
SVNCopySource source = sources[0]; String baseName = source.getName(); if (!source.isURL()) { baseName = SVNEncodingUtil.uriEncode(baseName);