From d57a8d99d00b79e126a47f61fe2e3ce0258889b1 Mon Sep 17 00:00:00 2001 From: irengrig Date: Wed, 30 May 2012 19:50:56 +0400 Subject: [PATCH] IDEA-85831 Branching and merging problems correctly (using high-level API applicable both for 1.6 and 1.7) determine base url when loading default assumptions about trunk and branches --- .../svn/branchConfig/DefaultConfigLoader.java | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java index 12f122fc4ab6..021568aac806 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultConfigLoader.java @@ -26,6 +26,7 @@ import org.tmatesoft.svn.core.*; import org.tmatesoft.svn.core.internal.util.SVNPathUtil; import org.tmatesoft.svn.core.internal.wc.admin.SVNEntry; import org.tmatesoft.svn.core.internal.wc.admin.SVNWCAccess; +import org.tmatesoft.svn.core.wc.SVNInfo; import org.tmatesoft.svn.core.wc.SVNLogClient; import org.tmatesoft.svn.core.wc.SVNRevision; @@ -45,23 +46,15 @@ public class DefaultConfigLoader { @Nullable public static SvnBranchConfigurationNew loadDefaultConfiguration(final Project project, final VirtualFile vcsRoot) { try { - SVNURL baseUrl = null; - final SVNWCAccess wcAccess = SVNWCAccess.newInstance(null); + final SvnVcs vcs = SvnVcs.getInstance(project); + File rootFile = new File(vcsRoot.getPath()); - wcAccess.open(rootFile, false, 0); - try { - SVNEntry entry = wcAccess.getEntry(rootFile, false); - if (entry != null) { - baseUrl = entry.getSVNURL(); - } - else { - LOG.info("Directory is not a working copy: " + vcsRoot.getPresentableUrl()); - return null; - } - } - finally { - wcAccess.close(); + final SVNInfo info = vcs.createWCClient().doInfo(rootFile, SVNRevision.UNDEFINED); + 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()); @@ -69,7 +62,7 @@ public class DefaultConfigLoader { final String s = SVNPathUtil.tail(baseUrl.getPath()); if (s.equalsIgnoreCase(DEFAULT_TRUNK_NAME) || s.equalsIgnoreCase(DEFAULT_BRANCHES_NAME) || s.equalsIgnoreCase(DEFAULT_TAGS_NAME)) { final SVNURL rootPath = baseUrl.removePathTail(); - SVNLogClient client = SvnVcs.getInstance(project).createLogClient(); + SVNLogClient client = vcs.createLogClient(); client.doList(rootPath, SVNRevision.UNDEFINED, SVNRevision.HEAD, false, false, new ISVNDirEntryHandler() { public void handleDirEntry(final SVNDirEntry dirEntry) throws SVNException { if (("".equals(dirEntry.getRelativePath())) || (! SVNNodeKind.DIR.equals(dirEntry.getKind()))) {