Rename the "origin" constant to a more laconic GitRemote.ORIGIN

This commit is contained in:
Kirill Likhodedov
2016-09-26 19:23:27 +03:00
parent 0c1b50e60f
commit 7716368550
5 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -1003,7 +1003,7 @@ public class GitUtil {
@Nullable
public static GitRemote getDefaultRemote(@NotNull Collection<GitRemote> remotes) {
for (GitRemote remote : remotes) {
if (remote.getName().equals(GitRemote.ORIGIN_NAME)) {
if (remote.getName().equals(GitRemote.ORIGIN)) {
return remote;
}
}
@@ -342,10 +342,10 @@ public class GitPushTargetPanel extends PushTargetPanel<GitPushTarget> {
String remoteName2 = o2.getRemote().getName();
int remoteComparison = remoteName1.compareTo(remoteName2);
if (remoteComparison != 0) {
if (remoteName1.equals(GitRemote.ORIGIN_NAME)) {
if (remoteName1.equals(GitRemote.ORIGIN)) {
return -1;
}
if (remoteName2.equals(GitRemote.ORIGIN_NAME)) {
if (remoteName2.equals(GitRemote.ORIGIN)) {
return 1;
}
return remoteComparison;
@@ -53,7 +53,7 @@ import com.intellij.util.ui.UIUtil
import git4idea.commands.Git
import git4idea.commands.GitCommandResult
import git4idea.repo.GitRemote
import git4idea.repo.GitRemote.ORIGIN_NAME
import git4idea.repo.GitRemote.ORIGIN
import git4idea.repo.GitRepository
import java.util.*
import javax.swing.*
@@ -98,7 +98,7 @@ class GitConfigureRemotesDialog(val project: Project, val repositories: Collecti
private fun addRemote() {
val repository = getSelectedRepo()
val proposedName = if (repository.remotes.any { it.name == GitRemote.ORIGIN_NAME }) "" else GitRemote.ORIGIN_NAME
val proposedName = if (repository.remotes.any { it.name == ORIGIN }) "" else ORIGIN
val dialog = GitDefineRemoteDialog(repository, git, proposedName, "")
if (dialog.showAndGet()) {
runInModalTask("Adding Remote...", repository,
@@ -176,10 +176,10 @@ class GitConfigureRemotesDialog(val project: Project, val repositories: Collecti
private fun sortedRemotes(repository: GitRepository): List<GitRemote> {
return repository.remotes.sortedWith(Comparator<GitRemote> { r1, r2 ->
if (r1.name == ORIGIN_NAME) {
if (r2.name == ORIGIN_NAME) 0 else -1
if (r1.name == ORIGIN) {
if (r2.name == ORIGIN) 0 else -1
}
else if (r2.name == ORIGIN_NAME) 1 else r1.name.compareTo(r2.name)
else if (r2.name == ORIGIN) 1 else r1.name.compareTo(r2.name)
})
}
@@ -52,7 +52,7 @@ public class GitDefineRemoteDialog extends DialogWrapper {
@NotNull private final JTextField myRemoteUrl;
public GitDefineRemoteDialog(@NotNull GitRepository repository, @NotNull Git git) {
this(repository, git, GitRemote.ORIGIN_NAME, "");
this(repository, git, GitRemote.ORIGIN, "");
}
public GitDefineRemoteDialog(@NotNull GitRepository repository,
@@ -69,7 +69,7 @@ public final class GitRemote implements Comparable<GitRemote> {
* Default remote name in Git is "origin".
* Usually all Git repositories have an "origin" remote, so it can be used as a default value in some cases.
*/
public static final String ORIGIN_NAME = "origin";
public static final String ORIGIN = "origin";
@NotNull private final String myName;
@NotNull private final List<String> myUrls;