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
This commit is contained in:
irengrig
2012-05-30 19:50:56 +04:00
parent 57428b841a
commit d57a8d99d0
@@ -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()))) {