public static String getRelativePath(SVNURL repoURL, SVNRepository repository) throws SVNException { String repoPath = repoURL.getPath().substring(repository.getRepositoryRoot(true).getPath().length()); if (!repoPath.startsWith("/")) repoPath = "/" + repoPath; return repoPath; }
private void onStateChangedToSuccess(final AuthenticationRequest obj) { myCopiesPassiveResults.put(getKey(obj), true); myVcs.invokeRefreshSvnRoots(false); final List<SVNURL> outdatedRequests = new LinkedList<SVNURL>(); final Collection<SVNURL> keys = getAllCurrentKeys(); for (SVNURL key : keys) { final SVNURL commonURLAncestor = SVNURLUtil.getCommonURLAncestor(key, obj.getUrl()); if ((commonURLAncestor != null) && (!StringUtil.isEmptyOrSpaces(commonURLAncestor.getHost())) && (!StringUtil.isEmptyOrSpaces(commonURLAncestor.getPath()))) { // final AuthenticationRequest currObj = getObj(key); // if ((currObj != null) && passiveValidation(myVcs.getProject(), key, true, // currObj.getRealm(), currObj.getKind())) { outdatedRequests.add(key); // } } } log("on state changed "); ApplicationManager.getApplication() .invokeLater( new Runnable() { public void run() { for (SVNURL key : outdatedRequests) { removeLazyNotificationByKey(key); } } }, ModalityState.NON_MODAL); }
@Nullable public static SvnBranchConfigurationNew loadDefaultConfiguration( final Project project, final VirtualFile vcsRoot) { try { final SvnVcs vcs = SvnVcs.getInstance(project); File rootFile = new File(vcsRoot.getPath()); final Info info = vcs.getInfo(rootFile); if (info == null || info.getURL() == null) { LOG.info("Directory is not a working copy: " + vcsRoot.getPresentableUrl()); return null; } SVNURL baseUrl = info.getURL(); final SvnBranchConfigurationNew result = new SvnBranchConfigurationNew(); result.setTrunkUrl(baseUrl.toString()); while (true) { final String s = SVNPathUtil.tail(baseUrl.getPath()); if (s.equalsIgnoreCase(DEFAULT_TRUNK_NAME) || s.equalsIgnoreCase(DEFAULT_BRANCHES_NAME) || s.equalsIgnoreCase(DEFAULT_TAGS_NAME)) { SVNURL rootPath = baseUrl.removePathTail(); SvnTarget target = SvnTarget.fromURL(rootPath); vcs.getFactory(target) .createBrowseClient() .list(target, SVNRevision.HEAD, Depth.IMMEDIATES, createHandler(result, rootPath)); break; } if (SVNPathUtil.removeTail(baseUrl.getPath()).length() == 0) { break; } baseUrl = baseUrl.removePathTail(); } return result; } catch (SVNException e) { LOG.info(e); return null; } catch (VcsException e) { LOG.info(e); return null; } }
private File dump(SVNURL url) throws SVNException { final File repositoryRoot = new File(url.getPath()); final SVNAdminClient adminClient = SVNClientManager.newInstance().getAdminClient(); adminClient.doDump( repositoryRoot, SVNDebugLog.getDefaultLog().createOutputLogStream(), SVNRevision.create(0), SVNRevision.HEAD, false, false); return repositoryRoot; }
public SVNURL[] getTrueMergeTargets( SVNURL sourceUrl, long sourceRevision, long sourceMergeFromRevision, long sourceMergeToRevision, SVNURL targetUrl, long targetRevision, SVNEditorAction action) throws SVNException { if (sourceUrl.getPath().endsWith("branch/A/file")) { return new SVNURL[] {getTrunk().appendPath("A/file2", false)}; } return null; }