IDEA-97459 Subversion: working copies refresh should not ask for authentication

This commit is contained in:
irengrig
2012-12-13 17:14:45 +04:00
parent 9dc3ba816e
commit bc6c95f79b
7 changed files with 29 additions and 14 deletions
@@ -42,7 +42,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
public void process(final FilePath path, final SVNStatus status) throws SVNException {
if ((path.getVirtualFile() != null) && SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_EXTERNAL)) {
final MyPointInfo info = new MyPointInfo(path.getVirtualFile(), null, WorkingCopyFormat.UNKNOWN, NestedCopyType.external);
final MyPointInfo info = new MyPointInfo(path.getVirtualFile(), null, WorkingCopyFormat.UNKNOWN, NestedCopyType.external, null);
mySet.add(info);
return;
}
@@ -57,7 +57,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
return;
}
final MyPointInfo info = new MyPointInfo(path.getVirtualFile(), status.getURL(),
WorkingCopyFormat.getInstance(status.getWorkingCopyFormat()), type);
WorkingCopyFormat.getInstance(status.getWorkingCopyFormat()), type, status.getRepositoryRootURL());
mySet.add(info);
}
@@ -68,8 +68,8 @@ public class NestedCopiesBuilder implements StatusReceiver {
}
@Override
public void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format) {
final MyPointInfo info = new MyPointInfo(file, url, format, NestedCopyType.inner);
public void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format, SVNURL rootURL) {
final MyPointInfo info = new MyPointInfo(file, url, format, NestedCopyType.inner, rootURL);
mySet.add(info);
}
@@ -87,18 +87,28 @@ public class NestedCopiesBuilder implements StatusReceiver {
private SVNURL myUrl;
private WorkingCopyFormat myFormat;
private final NestedCopyType myType;
private final SVNURL myRootURL;
MyPointInfo(@NotNull final VirtualFile file, final SVNURL url, final WorkingCopyFormat format, final NestedCopyType type) {
MyPointInfo(@NotNull final VirtualFile file,
final SVNURL url,
final WorkingCopyFormat format,
final NestedCopyType type,
SVNURL rootURL) {
myFile = file;
myUrl = url;
myFormat = format;
myType = type;
myRootURL = rootURL;
}
public void setUrl(SVNURL url) {
myUrl = url;
}
public SVNURL getRootURL() {
return myRootURL;
}
public void setFormat(WorkingCopyFormat format) {
myFormat = format;
}
@@ -27,6 +27,6 @@ public interface StatusReceiver extends EventListener {
void process(final FilePath path, final SVNStatus status) throws SVNException;
void processIgnored(final VirtualFile vFile);
void processUnversioned(final VirtualFile vFile);
void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format);
void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format, SVNURL rootURL);
void bewareRoot(VirtualFile vf, SVNURL url, WorkingCopyFormat copyFormat);
}
@@ -70,7 +70,7 @@ class SvnChangeProviderContext implements StatusReceiver {
}
@Override
public void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format) {
public void processCopyRoot(VirtualFile file, SVNURL url, WorkingCopyFormat format, SVNURL rootURL) {
}
@Override
@@ -366,7 +366,8 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
for (RootUrlInfo topRoot : myTopRoots) {
if (VfsUtil.isAncestor(topRoot.getVirtualFile(), info.getFile(), true)) {
final SVNURL repoRoot = myRepositoryRoots.ask(info.getUrl());
SVNURL repoRoot = info.getRootURL();
repoRoot = repoRoot == null ? myRepositoryRoots.ask(info.getUrl(), true) : repoRoot;
if (repoRoot != null) {
final RootUrlInfo rootInfo = new RootUrlInfo(repoRoot, info.getUrl(), info.getFormat(), info.getFile(), topRoot.getRoot());
rootInfo.setType(info.getType());
@@ -405,7 +406,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
myRoots.add(url);
}
public SVNURL ask(final SVNURL url) {
public SVNURL ask(final SVNURL url, boolean allowRemote) {
for (SVNURL root : myRoots) {
if (root.equals(SVNURLUtil.getCommonURLAncestor(root, url))) {
return root;
@@ -413,7 +414,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState
}
final SVNURL newUrl;
try {
newUrl = SvnUtil.getRepositoryRoot(myVcs, url);
newUrl = SvnUtil.getRepositoryRoot(myVcs, url, allowRemote);
if (newUrl != null) {
myRoots.add(newUrl);
return newUrl;
@@ -250,7 +250,7 @@ public class SvnRecursiveStatusWalker {
if (vf != null) {
if (myCurrentItem.isIsInnerCopyRoot()) {
myReceiver.processCopyRoot(vf, statusInner.getURL(),
WorkingCopyFormat.getInstance(statusInner.getWorkingCopyFormat()));
WorkingCopyFormat.getInstance(statusInner.getWorkingCopyFormat()), statusInner.getRepositoryRootURL());
} else {
myReceiver.bewareRoot(vf, statusInner.getURL(), WorkingCopyFormat.getInstance(statusInner.getWorkingCopyFormat()));
}
@@ -412,7 +412,7 @@ public class SvnUtil {
@Nullable
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final String url) {
try {
return getRepositoryRoot(vcs, SVNURL.parseURIEncoded(url));
return getRepositoryRoot(vcs, SVNURL.parseURIEncoded(url), true);
}
catch (SVNException e) {
return null;
@@ -420,8 +420,12 @@ public class SvnUtil {
}
@Nullable
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final SVNURL url) throws SVNException {
public static SVNURL getRepositoryRoot(final SvnVcs vcs, final SVNURL url, boolean allowRemote) throws SVNException {
final SVNWCClient client = vcs.createWCClient();
SVNInfo localInfo = client.doInfo(url, SVNRevision.UNDEFINED, SVNRevision.WORKING);
if (localInfo != null && localInfo.getRepositoryRootURL() != null || ! allowRemote) {
return localInfo == null ? null : localInfo.getRepositoryRootURL();
}
SVNInfo info = client.doInfo(url, SVNRevision.UNDEFINED, SVNRevision.HEAD);
return (info == null) ? null : info.getRepositoryRootURL();
}
@@ -137,7 +137,7 @@ public class SvnEditCommitMessageAction extends AnAction {
final String url = myLocation.getURL();
final SVNURL root;
try {
root = SvnUtil.getRepositoryRoot(myVcs, SVNURL.parseURIEncoded(url));
root = SvnUtil.getRepositoryRoot(myVcs, SVNURL.parseURIEncoded(url), true);
if (root == null) {
myException = new VcsException("Can not determine repository root for URL: " + url);
return;