mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git: extend API of GitFileAnnotation
GitOrigin-RevId: 7f20ac381d1304a057362597abbd546545fd9f52
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e5ad9532a
commit
da7e8be09f
@@ -270,10 +270,10 @@ public final class GitAnnotationProvider implements AnnotationProviderEx, Cachea
|
||||
if (commitHash.equals(GitRevisionNumber.NOT_COMMITTED_HASH)) {
|
||||
commitHash = null;
|
||||
}
|
||||
s.spaceToken(); // skip revision line number
|
||||
String s1 = s.spaceToken();
|
||||
int lineNum = Integer.parseInt(s1);
|
||||
s.nextLine();
|
||||
int originalLineNumber = Integer.parseInt(s.spaceToken());
|
||||
int lineNumber = Integer.parseInt(s.spaceToken());
|
||||
s.nextLine(); // skip number of lines in this group (if present)
|
||||
|
||||
// parse commit information
|
||||
LineInfo commit = commits.get(commitHash);
|
||||
if (commit != null || commitHash == null) {
|
||||
@@ -325,7 +325,7 @@ public final class GitAnnotationProvider implements AnnotationProviderEx, Cachea
|
||||
}
|
||||
|
||||
if (authorDate == null || committerDate == null || filePath == null || authorName == null || authorEmail == null || subject == null) {
|
||||
throw new VcsException("Output for line " + lineNum + " lacks necessary data");
|
||||
throw new VcsException("Output for line " + lineNumber + " lacks necessary data");
|
||||
}
|
||||
|
||||
GitRevisionNumber revisionNumber = new GitRevisionNumber(commitHash);
|
||||
@@ -337,14 +337,14 @@ public final class GitAnnotationProvider implements AnnotationProviderEx, Cachea
|
||||
if (previousFilePath != null) previousFilePath = pathInterner.intern(previousFilePath);
|
||||
|
||||
commit = new LineInfo(myProject, revisionNumber, filePath, committerDate, authorDate, author, subject,
|
||||
previousRevisionNumber, previousFilePath);
|
||||
previousRevisionNumber, previousFilePath, lineNumber, originalLineNumber);
|
||||
commits.put(commitHash, commit);
|
||||
}
|
||||
s.nextLine();
|
||||
|
||||
int expectedLineNum = lines.size() + 1;
|
||||
if (lineNum != expectedLineNum) {
|
||||
throw new VcsException("Adding for info for line " + lineNum + " but we are expecting it to be for " + expectedLineNum);
|
||||
if (lineNumber != expectedLineNum) {
|
||||
throw new VcsException("Adding for info for line " + lineNumber + " but we are expecting it to be for " + expectedLineNum);
|
||||
}
|
||||
|
||||
lines.add(commit);
|
||||
|
||||
@@ -270,7 +270,7 @@ public class GitFileAnnotation extends FileAnnotation {
|
||||
}
|
||||
}
|
||||
|
||||
static class LineInfo {
|
||||
public static class LineInfo {
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final GitRevisionNumber myRevision;
|
||||
@NotNull private final FilePath myFilePath;
|
||||
@@ -280,16 +280,20 @@ public class GitFileAnnotation extends FileAnnotation {
|
||||
@NotNull private final Date myAuthorDate;
|
||||
@NotNull private final VcsUser myAuthor;
|
||||
@NotNull private final String mySubject;
|
||||
private final int myLineNumber;
|
||||
private final int myOriginalLineNumber;
|
||||
|
||||
LineInfo(@NotNull Project project,
|
||||
@NotNull GitRevisionNumber revision,
|
||||
@NotNull FilePath path,
|
||||
@NotNull Date committerDate,
|
||||
@NotNull Date authorDate,
|
||||
@NotNull VcsUser author,
|
||||
@NotNull String subject,
|
||||
@Nullable GitRevisionNumber previousRevision,
|
||||
@Nullable FilePath previousPath) {
|
||||
@NotNull GitRevisionNumber revision,
|
||||
@NotNull FilePath path,
|
||||
@NotNull Date committerDate,
|
||||
@NotNull Date authorDate,
|
||||
@NotNull VcsUser author,
|
||||
@NotNull String subject,
|
||||
@Nullable GitRevisionNumber previousRevision,
|
||||
@Nullable FilePath previousPath,
|
||||
int lineNumber,
|
||||
int originalLineNumber) {
|
||||
myProject = project;
|
||||
myRevision = revision;
|
||||
myFilePath = path;
|
||||
@@ -299,6 +303,8 @@ public class GitFileAnnotation extends FileAnnotation {
|
||||
myAuthorDate = authorDate;
|
||||
myAuthor = author;
|
||||
mySubject = subject;
|
||||
myLineNumber = lineNumber;
|
||||
myOriginalLineNumber = originalLineNumber;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -341,6 +347,14 @@ public class GitFileAnnotation extends FileAnnotation {
|
||||
public String getSubject() {
|
||||
return mySubject;
|
||||
}
|
||||
|
||||
public int getLineNumber() {
|
||||
return myLineNumber;
|
||||
}
|
||||
|
||||
public int getOriginalLineNumber() {
|
||||
return myOriginalLineNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user