}
@Nullable
- public static VcsRevisionDescription getCurrentRevisionDescription(final Project project, FilePath filePath)
+ public static VcsRevisionDescription getCurrentRevisionDescription(@NotNull Project project, @NotNull FilePath filePath)
throws VcsException {
filePath = getLastCommitName(project, filePath);
GitSimpleHandler h = new GitSimpleHandler(project, GitUtil.getGitRoot(filePath), GitCommand.LOG);
* @throws VcsException if there is problem with running git
*/
@Nullable
- public static ItemLatestState getLastRevision(final Project project, FilePath filePath) throws VcsException {
+ public static ItemLatestState getLastRevision(@NotNull Project project, @NotNull FilePath filePath) throws VcsException {
VirtualFile root = GitUtil.getGitRoot(filePath);
GitBranch c = GitBranchUtil.getCurrentBranch(project, root);
GitBranch t = c == null ? null : GitBranchUtil.tracked(project, root, c.getName());
history(project, path, root, GitRevisionNumber.HEAD, consumer, exceptionConsumer, parameters);
}
- public static void history(@NotNull final Project project,
+ public static void history(@NotNull Project project,
@NotNull FilePath path,
@Nullable VirtualFile root,
@NotNull VcsRevisionNumber startingRevision,
- @NotNull final Consumer<GitFileRevision> consumer,
- @NotNull final Consumer<VcsException> exceptionConsumer,
+ @NotNull Consumer<GitFileRevision> consumer,
+ @NotNull Consumer<VcsException> exceptionConsumer,
String... parameters) {
// adjust path using change manager
final FilePath filePath = getLastCommitName(project, path);
}
}
- private static GitLineHandler getLogHandler(Project project,
+ @NotNull
+ private static GitLineHandler getLogHandler(@NotNull Project project,
@NotNull GitVersion version,
- VirtualFile root,
- GitLogParser parser,
- FilePath path,
- String lastCommit,
+ @NotNull VirtualFile root,
+ @NotNull GitLogParser parser,
+ @NotNull FilePath path,
+ @NotNull String lastCommit,
String... parameters) {
final GitLineHandler h = new GitLineHandler(project, root, GitCommand.LOG);
h.setStdoutSuppressed(true);
* If it's not a rename, returns null.
*/
@Nullable
- private static Pair<String, FilePath> getFirstCommitParentAndPathIfRename(Project project,
- VirtualFile root,
- String commit,
- FilePath filePath,
+ private static Pair<String, FilePath> getFirstCommitParentAndPathIfRename(@NotNull Project project,
+ @NotNull VirtualFile root,
+ @NotNull String commit,
+ @NotNull FilePath filePath,
@NotNull GitVersion version) throws VcsException {
// 'git show -M --name-status <commit hash>' returns the information about commit and detects renames.
// NB: we can't specify the filepath, because then rename detection will work only with the '--follow' option, which we don't wanna use.
return null;
}
- public static List<? extends VcsShortCommitDetails> readMiniDetails(final Project project, final VirtualFile root, List<String> hashes)
+ @NotNull
+ public static List<? extends VcsShortCommitDetails> readMiniDetails(@NotNull Project project,
+ @NotNull VirtualFile root,
+ @NotNull List<String> hashes)
throws VcsException {
final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project);
if (factory == null) {
@Nullable
public static List<VcsCommitMetadata> readLastCommits(@NotNull Project project,
- @NotNull final VirtualFile root,
+ @NotNull VirtualFile root,
@NotNull String... refs)
throws VcsException {
final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project);
processHandlerOutputByLine(h, recordConsumer, 0);
}
- public static void readCommits(@NotNull final Project project,
- @NotNull final VirtualFile root,
+ public static void readCommits(@NotNull Project project,
+ @NotNull VirtualFile root,
@NotNull List<String> parameters,
- @NotNull final Consumer<VcsUser> userConsumer,
- @NotNull final Consumer<VcsRef> refConsumer,
- @NotNull final Consumer<TimedVcsCommit> commitConsumer) throws VcsException {
+ @NotNull Consumer<VcsUser> userConsumer,
+ @NotNull Consumer<VcsRef> refConsumer,
+ @NotNull Consumer<TimedVcsCommit> commitConsumer) throws VcsException {
final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project);
if (factory == null) {
return;
@NotNull
private static List<TimedVcsCommit> parseCommit(@NotNull GitLogParser parser,
@NotNull StringBuilder record,
- @NotNull final Consumer<VcsUser> userRegistry,
- @NotNull final Consumer<VcsRef> refConsumer,
- @NotNull final VcsLogObjectsFactory factory,
- @NotNull final VirtualFile root) {
+ @NotNull Consumer<VcsUser> userRegistry,
+ @NotNull Consumer<VcsRef> refConsumer,
+ @NotNull VcsLogObjectsFactory factory,
+ @NotNull VirtualFile root) {
List<GitLogRecord> rec = parser.parse(record.toString());
return ContainerUtil.mapNotNull(rec, new Function<GitLogRecord, TimedVcsCommit>() {
@Override
@NotNull
private static Collection<VcsRef> parseRefs(@NotNull Collection<String> refs,
- @NotNull final Hash hash,
- @NotNull final VcsLogObjectsFactory factory,
- @NotNull final VirtualFile root) {
+ @NotNull Hash hash,
+ @NotNull VcsLogObjectsFactory factory,
+ @NotNull VirtualFile root) {
return ContainerUtil.mapNotNull(refs, new Function<String, VcsRef>() {
@Override
public VcsRef fun(String refName) {
}
@Nullable
- private static VcsLogObjectsFactory getObjectsFactoryWithDisposeCheck(@NotNull final Project project) {
+ private static VcsLogObjectsFactory getObjectsFactoryWithDisposeCheck(@NotNull Project project) {
return ApplicationManager.getApplication().runReadAction(new Computable<VcsLogObjectsFactory>() {
@Override
public VcsLogObjectsFactory compute() {
}
private static class MyTokenAccumulator {
- private final StringBuilder myBuffer = new StringBuilder();
+ @NotNull private final StringBuilder myBuffer = new StringBuilder();
+ @NotNull private final GitLogParser myParser;
private boolean myNotStarted = true;
- private GitLogParser myParser;
- public MyTokenAccumulator(GitLogParser parser) {
+ public MyTokenAccumulator(@NotNull GitLogParser parser) {
myParser = parser;
}
}
}
+ @Nullable
public GitLogRecord processLast() {
return processResult(myBuffer.toString());
}
- private GitLogRecord processResult(final String line) {
+ @Nullable
+ private GitLogRecord processResult(@NotNull String line) {
return myParser.parseOneRecord(line);
}
}
* @return the list of the revisions
* @throws VcsException if there is problem with running git
*/
- public static List<VcsFileRevision> history(final Project project, final FilePath path, String... parameters) throws VcsException {
+ @NotNull
+ public static List<VcsFileRevision> history(@NotNull Project project, @NotNull FilePath path, String... parameters) throws VcsException {
final VirtualFile root = GitUtil.getGitRoot(path);
return history(project, path, root, parameters);
}
+ @NotNull
public static List<VcsFileRevision> history(@NotNull Project project,
@NotNull FilePath path,
@Nullable VirtualFile root,
return history(project, path, root, GitRevisionNumber.HEAD, parameters);
}
+ @NotNull
public static List<VcsFileRevision> history(@NotNull Project project,
@NotNull FilePath path,
@Nullable VirtualFile root,
*/
@Deprecated
@SuppressWarnings("unused")
- public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project, FilePath path, final String... parameters)
+ @NotNull
+ public static List<Pair<SHAHash, Date>> onlyHashesHistory(@NotNull Project project, @NotNull FilePath path, String... parameters)
throws VcsException {
final VirtualFile root = GitUtil.getGitRoot(path);
return onlyHashesHistory(project, path, root, parameters);
* @deprecated To remove in IDEA 17
*/
@Deprecated
- public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project,
- FilePath path,
- final VirtualFile root,
- final String... parameters)
+ @NotNull
+ public static List<Pair<SHAHash, Date>> onlyHashesHistory(@NotNull Project project,
+ @NotNull FilePath path,
+ @NotNull VirtualFile root,
+ String... parameters)
throws VcsException {
// adjust path using change manager
path = getLastCommitName(project, path);
* and it can occupy too much memory. The estimate is ~600Kb for 1000 commits.</p>
*/
@NotNull
- public static List<GitCommit> history(@NotNull final Project project, @NotNull final VirtualFile root, String... parameters)
+ public static List<GitCommit> history(@NotNull Project project, @NotNull VirtualFile root, String... parameters)
throws VcsException {
final VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project);
if (factory == null) {
}, parameters);
}
+ @NotNull
private static GitLogParser createParserForDetails(@NotNull GitTextHandler h,
@NotNull Project project,
boolean withRefs,
return commits;
}
+ @NotNull
private static GitCommit createCommit(@NotNull Project project, @NotNull VirtualFile root, @NotNull GitLogRecord record,
@NotNull VcsLogObjectsFactory factory) {
List<Hash> parents = getParentHashes(factory, record);
}
@NotNull
- private static List<Hash> getParentHashes(@NotNull final VcsLogObjectsFactory factory, @NotNull GitLogRecord record) {
+ private static List<Hash> getParentHashes(@NotNull VcsLogObjectsFactory factory, @NotNull GitLogRecord record) {
return ContainerUtil.map(record.getParentsHashes(), new Function<String, Hash>() {
@Override
public Hash fun(String hash) {
}
@Nullable
- private static String parseRefs(@Nullable SymbolicRefsI refs, Collection<String> currentRefs, List<String> locals,
- List<String> remotes, List<String> tags) {
+ private static String parseRefs(@Nullable SymbolicRefsI refs, @NotNull Collection<String> currentRefs, @NotNull List<String> locals,
+ @NotNull List<String> remotes, @NotNull List<String> tags) {
if (refs == null) {
return null;
}
@Deprecated
@NotNull
public static List<GitHeavyCommit> commitsDetails(@NotNull Project project, @NotNull FilePath path, @Nullable SymbolicRefsI refs,
- @NotNull final Collection<String> commitsIds) throws VcsException {
+ @NotNull Collection<String> commitsIds) throws VcsException {
path = getLastCommitName(project, path); // adjust path using change manager
VirtualFile root = GitUtil.getGitRoot(path);
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.SHOW);
return rc;
}
- public static long getAuthorTime(Project project, FilePath path, final String commitsId) throws VcsException {
+ public static long getAuthorTime(@NotNull Project project, @NotNull FilePath path, @NotNull String commitsId) throws VcsException {
// adjust path using change manager
path = getLastCommitName(project, path);
final VirtualFile root = GitUtil.getGitRoot(path);
}
@Nullable
- public static GitRevisionNumber getMergeBase(final Project project, final VirtualFile root, @NotNull final String first,
- @NotNull final String second)
+ public static GitRevisionNumber getMergeBase(@NotNull Project project, @NotNull VirtualFile root, @NotNull String first,
+ @NotNull String second)
throws VcsException {
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.MERGE_BASE);
h.setSilent(true);