public static List<String> findTargetDuplications(SVNExternal[] externals) { List<String> paths = new ArrayList<String>(); for (int i = 0; i < externals.length; i++) { final SVNExternal external = externals[i]; String path = external.getPath(); for (int j = i + 1; j < externals.length; j++) { SVNExternal anotherExternal = externals[j]; String anotherPath = anotherExternal.getPath(); if (path.equals(anotherPath)) { paths.add(path); } } } return paths; }
Map newParsedExternals = new LinkedHashMap(); for (int i = 0; current != null && i < current.length; i++) { newParsedExternals.put(current[i].getPath(), current[i]); oldParsedExternals.put(previous[i].getPath(), previous[i]); externalDiff.ownerURL = fromURL.appendPath(diffPath, false); handleExternalItemChange(wcAccess, externalDiff.oldExternal.getPath(), externalDiff); externalDiff.ownerURL = fromURL.appendPath(diffPath, false); handleExternalItemChange(wcAccess, externalDiff.newExternal.getPath(), externalDiff);
/** * @param modulePath The root of the current module that svn was checking out when it hits 'ext'. * Since we call svnkit multiple times in general case to check out from multiple locations, * we use this to make the path relative to the entire workspace, not just the particular module. */ public External(String modulePath, SVNExternal ext) { this.path = modulePath + '/' + ext.getPath(); this.url = ext.getResolvedURL().toDecodedString(); this.revision = ext.getRevision().getNumber(); }
/** * @param modulePath The root of the current module that svn was checking out when it hits 'ext'. * Since we call svnkit multiple times in general case to check out from multiple locations, * we use this to make the path relative to the entire workspace, not just the particular module. */ public External(String modulePath, SVNExternal ext) { this.path = modulePath + '/' + ext.getPath(); this.url = ext.getResolvedURL().toDecodedString(); this.revision = ext.getRevision().getNumber(); }
private void relocateExternals(File localAbsPath, SVNExternal[] externals, SVNURL oldReposRootUrl, SVNURL newReposRootUrl) throws SVNException { for (int i = 0; i < externals.length; i++) { String rawUrl = externals[i].getUnresolvedUrl(); if (!(rawUrl.startsWith("../") || rawUrl.startsWith("^/"))) { continue; } File targetPath = SVNFileUtil.createFilePath(localAbsPath, externals[i].getPath()); try { SVNURL targetRepositoryRootUrl = getWcContext().getNodeReposInfo(targetPath).reposRootUrl; if (targetRepositoryRootUrl.equals(oldReposRootUrl)) { SvnWcDbRelocate.relocate(getWcContext(), targetPath, oldReposRootUrl, newReposRootUrl, this); } } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.WC_PATH_NOT_FOUND) { continue; } } } }
SVNExternal[] externals = SVNExternal.parseExternals(defPath, externalDefinition); for (int i = 0; i < externals.length; i++) { File targetAbsPath = SVNFileUtil.createFilePath(defPath, externals[i].getPath()); if (targetAbsPath.equals(wcRoot)) { return getWorkingCopyRootNg(parentWcRoot, stopOnExternals);
File externalFile = new File(parent, external.getPath()); if (externalFile.equals(versionedDir)) { return parentRoot;
new External(modulePath + "/" + path.substring(0, path.length() - ext.getPath().length()), ext));
new External(modulePath + "/" + path.substring(0, path.length() - ext.getPath().length()), ext));
private void listExternalItems(SVNRepository repository, SVNExternal[] externalItems, SVNURL externalParentUrl, SVNDepth depth, int entryFields, boolean fetchLocks, ISVNDirEntryHandler handler) throws SVNException { SVNURL rootUrl = repository.getRepositoryRoot(true); for (SVNExternal externalItem : externalItems) { SVNURL resolvedURL = externalItem.resolveURL(rootUrl, externalParentUrl); try { //TODO: peg revision repository.setLocation(resolvedURL, true); doList(repository, externalItem.getRevision().getNumber(), handler, fetchLocks, depth, entryFields, externalParentUrl, externalItem.getPath()); } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() != SVNErrorCode.CANCELLED) { if (getOperation().getEventHandler() != null) { SVNEvent event = SVNEventFactory.createSVNEvent(new File(externalItem.getPath()), SVNNodeKind.UNKNOWN, null, -1, SVNEventAction.FAILED_EXTERNAL, SVNEventAction.FAILED_EXTERNAL, e.getErrorMessage(), null); getOperation().getEventHandler().handleEvent(event, UNKNOWN); } } else { throw e; } } } } }
for (int i = 0; i < externals.length; i++) { SVNExternal info = externals[i]; File srcPath = new File(adminArea.getRoot(), info.getPath()); File dstPath = new File(to, info.getPath()); if (SVNPathUtil.getSegmentsCount(info.getPath()) > 1) { if (!dstPath.getParentFile().exists() && !dstPath.getParentFile().mkdirs()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CLIENT_IS_DIRECTORY, "Could not create directory ''{0}''", dstPath.getParentFile()), SVNLogType.WC);
File owner = new File(adminAreaInfo.getAnchor().getRoot(), path); for (int i = 0; i < exts.length; i++) { File externalFile = new File(owner, exts[i].getPath()); try { doCanonicalizeURLs(externalFile, omitDefaultPort, true);
private void handleExternalsChange(SVNURL reposRoot, File externalPath, String externalDefinition, Map<File, File> oldExternals, SVNDepth ambientDepth, SVNDepth requestedDepth) throws SVNException { if ((requestedDepth.compareTo(SVNDepth.INFINITY) < 0 && requestedDepth != SVNDepth.UNKNOWN) || ambientDepth.compareTo(SVNDepth.INFINITY) < 0 && requestedDepth.compareTo(SVNDepth.INFINITY) < 0) { return; } if (externalDefinition != null) { SVNExternal[] externals = SVNExternal.parseExternals(externalPath, externalDefinition); SVNURL url = getWcContext().getNodeUrl(externalPath); for (int i = 0; i < externals.length; i++) { File targetAbsPath = SVNFileUtil.createFilePath(externalPath, externals[i].getPath()); File oldExternalDefiningPath = oldExternals.get(targetAbsPath); try { handleExternalItemChange(reposRoot, externalPath, url, targetAbsPath, oldExternalDefiningPath, externals[i]); } catch (SVNCancelException cancel) { throw cancel; } catch (SVNException e) { handleEvent(SVNEventFactory.createSVNEvent(targetAbsPath, SVNNodeKind.NONE, null, -1, SVNEventAction.FAILED_EXTERNAL, SVNEventAction.UPDATE_EXTERNAL, e.getErrorMessage(), null)); } if (oldExternalDefiningPath != null) { oldExternals.remove(targetAbsPath); } } } }
File owner = new File(adminAreaInfo.getAnchor().getRoot(), path); for (int i = 0; i < exts.length; i++) { File externalFile = new File(owner, exts[i].getPath()); try { doCanonicalizeURLs(externalFile, omitDefaultPort, true);
File owner = new File(adminAreaInfo.getAnchor().getRoot(), path); for (int i = 0; i < exts.length; i++) { File externalFile = new File(owner, exts[i].getPath()); try { doCanonicalizeURLs(externalFile, omitDefaultPort, true);
@Override protected Void run(SVNWCContext context) throws SVNException { File lockRootPath = null; SVNExternalsStore store = getOperation().isIgnoreExternals() ? null : new SVNExternalsStore(); try { lockRootPath = context.acquireWriteLock(getFirstTarget(), false, true); context.canonicalizeURLs(getFirstTarget(), store, getOperation().isOmitDefaultPort()); } finally { if (lockRootPath != null) { context.releaseWriteLock(lockRootPath); } } if (!getOperation().isIgnoreExternals()) { for (File path : store.getNewExternals().keySet()) { String externalPropertyValue = store.getNewExternals().get(path); SVNExternal[] externals = SVNExternal.parseExternals(path, externalPropertyValue); for (int i = 0; i < externals.length; i++) { File externalPath = SVNFileUtil.createFilePath(path, externals[i].getPath()); if (externalPath.isDirectory()) { SvnCanonicalizeUrls canonicalize = getOperation().getOperationFactory().createCanonicalizeUrls(); canonicalize.setSingleTarget(SvnTarget.fromFile(externalPath)); canonicalize.setOmitDefaultPort(getOperation().isOmitDefaultPort()); canonicalize.run(); } } } } return null; }
revisionString = "-r" + externalPegRevision.getNumber() + " "; return maybeQuote(item.getPath()) + " " + revisionString + maybeQuote(item.getRawURL()) + "\n"; case 2: if (externalPegRevision == SVNRevision.UNDEFINED) { pegRevisionString = "@" + externalPegRevision.getNumber(); return revisionString + maybeQuote(item.getRawURL() + pegRevisionString) + " " + maybeQuote(item.getPath()) + "\n"; default: SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.CLIENT_INVALID_EXTERNALS_DESCRIPTION, "{0} property defined at ''{1}'' is using an unsupported syntax", SVNProperty.EXTERNALS, localAbsPathOrUrl.getFile());
SVNURL directoryUrl = fromUrl.appendPath(relativePath, false); for (int i = 0; i < exts.length; i++) { File externalDirectory = new File(dirPath, exts[i].getPath()); File parentDirectory = SVNFileUtil.getParentFile(externalDirectory); if (parentDirectory != null) {
SVNExternal[] externalDefs = SVNExternal.parseExternals(localAbsPath, externalsValues); for (SVNExternal externalDef : externalDefs) { File externalPath = SVNFileUtil.createFilePath(localAbsPath, externalDef.getPath());