Fix getting svn history when repository url contains space character

IDEA-176854
This commit is contained in:
Konstantin Kolosovsky
2017-08-11 17:13:47 +03:00
parent 15842e5c0b
commit 3b4a22a915
@@ -69,6 +69,8 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import static org.jetbrains.idea.svn.SvnUtil.getRelativeUrl;
public class SvnHistoryProvider
implements VcsHistoryProvider, VcsCacheableHistorySessionFactory<Boolean, SvnHistorySession> {
private final SvnVcs myVcs;
@@ -334,13 +336,9 @@ public class SvnHistoryProvider
@Override
protected void load() {
String relativeUrl = myUrl;
final SVNURL repoRootURL = myInfo.getRepositoryRootURL();
final String root = repoRootURL.toString();
if (myUrl != null && myUrl.startsWith(root)) {
relativeUrl = myUrl.substring(root.length());
}
SVNURL repoRootURL = myInfo.getRepositoryRootURL();
String relativeUrl = getRelativeUrl(repoRootURL.toDecodedString(), myUrl);
if (myPI != null) {
myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl));
}
@@ -415,11 +413,7 @@ public class SvnHistoryProvider
if (rootURL == null) {
throw new VcsException("Could not find repository root for URL: " + myUrl);
}
final String root = rootURL.toString();
String relativeUrl = myUrl;
if (myUrl.startsWith(root)) {
relativeUrl = myUrl.substring(root.length());
}
String relativeUrl = getRelativeUrl(rootURL.toDecodedString(), myUrl);
SvnTarget target = SvnTarget.fromURL(svnurl, myPeg == null ? myFrom : myPeg);
RepositoryLogEntryHandler handler =
new RepositoryLogEntryHandler(myVcs, myUrl, SVNRevision.UNDEFINED, relativeUrl, createConsumerAdapter(myConsumer), rootURL);
@@ -443,13 +437,12 @@ public class SvnHistoryProvider
// this method is called when svnurl does not exist in latest repository revision - thus concrete old revision is used for "info"
// command to get repository url
Info info = myVcs.getInfo(svnurl, myPeg, myPeg);
final SVNURL rootURL = info != null ? info.getRepositoryRootURL() : null;
final String root = rootURL != null ? rootURL.toString() : "";
String relativeUrl = myUrl;
if (myUrl.startsWith(root)) {
relativeUrl = myUrl.substring(root.length());
if (info == null || info.getRepositoryRootURL() == null) {
throw new VcsException("Could not find repository root for URL: " + svnurl + " in revision " + myPeg);
}
SVNURL rootURL = info.getRepositoryRootURL();
String relativeUrl = getRelativeUrl(rootURL.toDecodedString(), myUrl);
final RepositoryLogEntryHandler repositoryLogEntryHandler =
new RepositoryLogEntryHandler(myVcs, myUrl, SVNRevision.UNDEFINED, relativeUrl, revision -> myConsumer.consume(revision), rootURL);
repositoryLogEntryHandler.setThrowCancelOnMeetPathCreation(true);