summaryrefslogtreecommitdiff
path: root/plugins/hg4idea
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hg4idea')
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java25
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java16
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java2
3 files changed, 23 insertions, 20 deletions
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
index 14f6c981777b..1d41cdc688f9 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
@@ -35,7 +35,7 @@ import org.zmlx.hg4idea.HgVcsMessages;
class HgCommandAuthenticator {
private static final Logger LOG = Logger.getInstance(HgCommandAuthenticator.class.getName());
-
+
private GetPasswordRunnable myGetPassword;
private final Project myProject;
private boolean myForceAuthorization;
@@ -71,7 +71,7 @@ class HgCommandAuthenticator {
}
public boolean promptForAuthentication(Project project, String proposedLogin, String uri, String path, @Nullable ModalityState state) {
- GetPasswordRunnable runnable = new GetPasswordRunnable(project, proposedLogin, uri, path, myForceAuthorization);
+ GetPasswordRunnable runnable = new GetPasswordRunnable(project, proposedLogin, uri, path, myForceAuthorization, state);
ApplicationManager.getApplication().invokeAndWait(runnable, state == null ? ModalityState.defaultModalityState() : state);
myGetPassword = runnable;
return runnable.isOk();
@@ -96,14 +96,21 @@ class HgCommandAuthenticator {
@Nullable private String myURL;
private boolean myRememberPassword;
private boolean myForceAuthorization;
-
- public GetPasswordRunnable(Project project, String proposedLogin, String uri, String path, boolean forceAuthorization) {
+ @Nullable private ModalityState myState;
+
+ public GetPasswordRunnable(Project project,
+ String proposedLogin,
+ String uri,
+ String path,
+ boolean forceAuthorization,
+ @Nullable ModalityState state) {
this.myProject = project;
this.myProposedLogin = proposedLogin;
this.myURL = uri + path;
this.myForceAuthorization = forceAuthorization;
+ myState = state;
}
-
+
public void run() {
// find if we've already been here
@@ -128,11 +135,9 @@ class HgCommandAuthenticator {
final String key = keyForUrlAndLogin(myURL, login);
try {
final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
- password = passwordSafe.getMemoryProvider().getPassword(myProject, HgCommandAuthenticator.class, key);
- if (password == null) {
- password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key);
- }
- } catch (PasswordSafeException e) {
+ password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key, myState);
+ }
+ catch (PasswordSafeException e) {
LOG.info("Couldn't get password for key [" + key + "]", e);
}
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
index 9fa266e560a1..8a5949140d23 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java
@@ -90,17 +90,10 @@ public class HgRefManager implements VcsLogRefManager {
}
};
-/*
- public HgRefManager(@NotNull RepositoryManager<HgRepository> repositoryManager) {
- myRepositoryManager = repositoryManager;
- }*/
-
@NotNull
@Override
- public List<VcsRef> sort(Collection<VcsRef> refs) {
- ArrayList<VcsRef> list = new ArrayList<VcsRef>(refs);
- Collections.sort(list, REF_COMPARATOR);
- return list;
+ public Comparator<VcsRef> getComparator() {
+ return REF_COMPARATOR;
}
@NotNull
@@ -114,6 +107,11 @@ public class HgRefManager implements VcsLogRefManager {
});
}
+ @NotNull
+ private Collection<VcsRef> sort(@NotNull Collection<VcsRef> refs) {
+ return ContainerUtil.sorted(refs, getComparator());
+ }
+
private static class SimpleRefType implements VcsRefType {
private final boolean myIsBranch;
@NotNull private final Color myColor;
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
index 4052b34a60d5..038c1c24121f 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
@@ -99,7 +99,7 @@ public class HgUpdateEnvironment implements UpdateEnvironment {
}
public String getHelpTopic() {
- return null;
+ return "reference.VersionControl.Mercurial.UpdateProject";
}
public JComponent createComponent() {