diff options
author | Tor Norbye <tnorbye@google.com> | 2014-09-04 20:44:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-04 20:44:01 +0000 |
commit | fb5a02906f644d044eb0286bf27d413ba0e05216 (patch) | |
tree | bca7d49005d81d10c70bc3f547df041c636b4300 /plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java | |
parent | 9cde0e3c015174898df8b8f3672185941fad4786 (diff) | |
parent | d245f58efbfc26b13b9b9d5e52e6a83a0d76216c (diff) | |
download | idea-fb5a02906f644d044eb0286bf27d413ba0e05216.tar.gz |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java')
-rw-r--r-- | plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java index ffc21a011334..29f15423e581 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationNotifier.java @@ -44,6 +44,10 @@ import com.intellij.util.proxy.CommonProxy; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.*; +import org.jetbrains.idea.svn.api.ClientFactory; +import org.jetbrains.idea.svn.commandLine.SvnBindException; +import org.jetbrains.idea.svn.info.Info; +import org.jetbrains.idea.svn.info.InfoClient; import org.tmatesoft.svn.core.SVNAuthenticationException; import org.tmatesoft.svn.core.SVNCancelException; import org.tmatesoft.svn.core.SVNException; @@ -172,6 +176,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica } log("on state changed "); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { for (SVNURL key : outdatedRequests) { removeLazyNotificationByKey(key); @@ -223,7 +228,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica /** * Bases on presence of notifications! */ - public ThreeState isAuthenticatedFor(@NotNull VirtualFile vf) { + public ThreeState isAuthenticatedFor(@NotNull VirtualFile vf, @Nullable ClientFactory factory) { final WorkingCopy wcCopy = myRootsToWorkingCopies.getWcRoot(vf); if (wcCopy == null) return ThreeState.UNSURE; @@ -236,11 +241,24 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica if (Boolean.FALSE.equals(keptResult)) return ThreeState.NO; // check have credentials - final boolean calculatedResult = passiveValidation(myVcs.getProject(), wcCopy.getUrl()); + final boolean calculatedResult = + factory == null ? passiveValidation(myVcs.getProject(), wcCopy.getUrl()) : passiveValidation(factory, wcCopy.getUrl()); myCopiesPassiveResults.put(wcCopy.getUrl(), calculatedResult); return calculatedResult ? ThreeState.YES : ThreeState.NO; } + private static boolean passiveValidation(@NotNull ClientFactory factory, @NotNull SVNURL url) { + Info info = null; + + try { + info = factory.create(InfoClient.class, false).doInfo(url, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED); + } + catch (SvnBindException ignore) { + } + + return info != null; + } + @NotNull @Override protected String getNotificationContent(AuthenticationRequest obj) { @@ -470,6 +488,7 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica final File authDir = new File(configuration.getConfigurationDirectory(), "auth"); if (authDir.exists()) { final Runnable process = new Runnable() { + @Override public void run() { final ProgressIndicator ind = ProgressManager.getInstance().getProgressIndicator(); if (ind != null) { @@ -477,7 +496,8 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl<SvnAuthentica ind.setText("Clearing stored credentials in " + authDir.getAbsolutePath()); } final File[] files = authDir.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { + @Override + public boolean accept(@NotNull File dir, @NotNull String name) { return ourAuthKinds.contains(name); } }); |