From 32edddfd8a03e91f426b3f154453aa54da262dfc Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Sun, 24 Jul 2011 17:54:47 +0400 Subject: [PATCH] @NotNull, @Nullable --- plugins/git4idea/src/git4idea/GitVcs.java | 4 ++++ plugins/git4idea/src/git4idea/config/GitVersion.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/plugins/git4idea/src/git4idea/GitVcs.java b/plugins/git4idea/src/git4idea/GitVcs.java index 0e73efd05790..c3e0aba815f1 100644 --- a/plugins/git4idea/src/git4idea/GitVcs.java +++ b/plugins/git4idea/src/git4idea/GitVcs.java @@ -483,6 +483,10 @@ public class GitVcs extends AbstractVcs { } } + /** + * @return the version number of Git, which is used by IDEA. null can be returned if the GitVcs hasn't yet activated. + */ + @Nullable public GitVersion getVersion() { return myVersion; } diff --git a/plugins/git4idea/src/git4idea/config/GitVersion.java b/plugins/git4idea/src/git4idea/config/GitVersion.java index 5b8e92af585e..f76a70b7af0d 100644 --- a/plugins/git4idea/src/git4idea/config/GitVersion.java +++ b/plugins/git4idea/src/git4idea/config/GitVersion.java @@ -24,6 +24,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import org.apache.commons.lang.builder.HashCodeBuilder; +import org.jetbrains.annotations.NotNull; import java.text.ParseException; import java.util.concurrent.TimeoutException; @@ -82,6 +83,7 @@ public final class GitVersion implements Comparable { /** * Parses output of "git version" command. */ + @NotNull public static GitVersion parse(String output) throws ParseException { if (StringUtil.isEmptyOrSpaces(output)) { throw new ParseException("Empty git --version output: " + output, 0); @@ -117,6 +119,7 @@ public final class GitVersion implements Comparable { return Integer.parseInt(match); } + @NotNull public static GitVersion identifyVersion(String gitExecutable) throws TimeoutException, ExecutionException, ParseException { GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(gitExecutable);