@Override public void run(ContinuationContext continuationContext) { if (SVNPathUtil.isAncestor(mySourceUrl, myWcInfo.getRootUrl()) || SVNPathUtil.isAncestor(myWcInfo.getRootUrl(), mySourceUrl)) { finishWithError(continuationContext, "Cannot merge from self", true); return; } if (!checkForSwitchedRoots()) { continuationContext.cancelEverything(); } }
@SuppressWarnings("unchecked") private List<ChangeInfo> logEntryToChangeInfos( final String rootPath, final String loggedPath, final SVNLogEntry entry, final boolean pathOnly) { final String fullLoggedPathFromAppend = SVNPathUtil.append(rootPath, loggedPath); final String fullLoggedPath = (!fullLoggedPathFromAppend.startsWith("/")) ? "/" + fullLoggedPathFromAppend : fullLoggedPathFromAppend; final List<ChangeInfo> results = new LinkedList<ChangeInfo>(); for (String changedPath : (Iterable<String>) entry.getChangedPaths().keySet()) { if (SVNPathUtil.isAncestor(rootPath, changedPath) && (!pathOnly || fullLoggedPath.equals(changedPath))) { ChangeInfo change = classifiedChange(entry, rootPath, changedPath); // Might want to put this at a higher level if we can ever do // something useful with 'other' changes. if (change.getKind() != StoreKind.OTHER) { results.add(change); } } } return results; }
@Nullable public String getUrlRootForUrl(final String currentUrl) { for (String url : myMapping.getUrls()) { if (SVNPathUtil.isAncestor(url, currentUrl)) { return url; } } return null; }
// TODO: this makes sense only for directories, but should always return true if something under // the directory was changed in revision // TODO: as svn will provide child changes in history for directory private boolean checkForChildChanges(LogEntry logEntry) { final String lastPathBefore = myLastPathCorrector.getBefore(); for (String key : logEntry.getChangedPaths().keySet()) { if (SVNPathUtil.isAncestor(lastPathBefore, key)) { return true; } } return false; }
@Override public void run(ContinuationContext continuationContext) { final SVNURL branch = SvnBranchConfigurationManager.getInstance(myProject) .getSvnBranchConfigManager() .getWorkingBranchWithReload(myWcInfo.getUrl(), myRoot); if (branch != null && (!myWcInfo.getUrl().equals(branch))) { final String branchString = branch.toString(); if (SVNPathUtil.isAncestor(branchString, myWcInfo.getRootUrl())) { final String subPath = SVNPathUtil.getRelativePath(branchString, myWcInfo.getRootUrl()); mySourceUrl = SVNPathUtil.append(mySourceUrl, subPath); } } }
static ChangeInfo classifiedChange(final SVNLogEntry entry, String rootPath, final String path) { StoreKind kind = StoreKind.OTHER; // Be sure the root path ends with a slash because the 'path' will always have the slash. if (!rootPath.endsWith("/")) { rootPath = rootPath + "/"; } String name = path.length() > rootPath.length() ? path.substring(rootPath.length()) : path; String page = null; Matcher matcher = PAGE_PATH.matcher(name); if (matcher.matches() && !name.endsWith("-attachments")) { kind = StoreKind.PAGE; page = name; } else { matcher = ATTACHMENT_PATH.matcher(name); if (matcher.matches()) { kind = StoreKind.ATTACHMENT; page = matcher.group(1); name = matcher.group(2); } } String user = entry.getAuthor(); Date date = entry.getDate(); SVNLogEntryPath logForPath = (SVNLogEntryPath) entry.getChangedPaths().get(path); String copiedFrom = logForPath.getCopyPath(); long copiedFromRevision = -1; if (SVNPathUtil.isAncestor(rootPath, copiedFrom)) { copiedFrom = SVNPathUtil.tail(copiedFrom); copiedFromRevision = logForPath.getCopyRevision(); } else { copiedFrom = null; } return new ChangeInfo( page, name, user, date, entry.getRevision(), entry.getMessage(), kind, ChangeType.forCode(logForPath.getType()), copiedFrom, copiedFromRevision); }
public void accept(final SVNLogEntry entry) { final Map changedPaths = entry.getChangedPaths(); if (changedPaths == null) return; for (Object o : changedPaths.values()) { final SVNLogEntryPath entryPath = (SVNLogEntryPath) o; if (entryPath != null && 'A' == entryPath.getType() && entryPath.getCopyPath() != null) { if (myCurrentPath.equals(entryPath.getPath())) { myHadChanged = true; myCurrentPath = entryPath.getCopyPath(); return; } else if (SVNPathUtil.isAncestor(entryPath.getPath(), myCurrentPath)) { final String relativePath = SVNPathUtil.getRelativePath(entryPath.getPath(), myCurrentPath); myCurrentPath = SVNPathUtil.append(entryPath.getCopyPath(), relativePath); myHadChanged = true; return; } } } }
private boolean isLocalRevisionMergeIteration( final TreeStructureNode<SVNLogEntry> tree, final String localURL, ProgressIndicator indicator) { final LinkedList<TreeStructureNode<SVNLogEntry>> queue = new LinkedList<TreeStructureNode<SVNLogEntry>>(); queue.addLast(tree); while (!queue.isEmpty()) { final TreeStructureNode<SVNLogEntry> element = queue.removeFirst(); indicator.checkCanceled(); final Map map = element.getMe().getChangedPaths(); for (Object o : map.values()) { final SVNLogEntryPath path = (SVNLogEntryPath) o; if (SVNPathUtil.isAncestor(localURL, path.getPath())) { return true; } break; // do not check all. first should match or fail } queue.addAll(element.getChildren()); } return false; }