-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2196] Use git blame line info for aggregate blame author modified and date info #2232
Open
logical-1985516
wants to merge
34
commits into
reposense:master
Choose a base branch
from
logical-1985516:2196-use-GitBlameLineInfo-for-aggregateBlameAuthorModifiedAndDateInfo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
0f8de06
Replace string wrangling with blameLine
logical-1985516 8c74f33
Fix lineNumber argument for blameLine and commitDate
logical-1985516 cd69a96
Improve variable name, add comments and replace magic numbers
logical-1985516 f8ddc62
Replace commitHash in blameLine with "" to return all blame lines
logical-1985516 72b1f89
Edit commitHash to now be returned from blameLineInfo for abstraction
logical-1985516 92ccb77
Add variable commitDateInMs for better readability
logical-1985516 c0c78a6
Rename method to be in seconds and change to commit-time in blameLine
logical-1985516 5073ecf
Remove unused constant COMMIT_TIME_OFFSET
logical-1985516 310856e
Remove unused constants
logical-1985516 5b6caf0
Change milliseconds to seconds
logical-1985516 b869ba1
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
logical-1985516 22473ba
Add and use blameFile that returns a list of GitBlameLineInfo
logical-1985516 ed17dc8
Add timeOption in processGitBlameResultLine and clean up statements
logical-1985516 c8115e2
Merge branch '2196-use-GitBlameLineInfo-for-aggregateBlameAuthorModif…
logical-1985516 37e8f6b
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
logical-1985516 c6e4015
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
logical-1985516 eab3489
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
gok99 cecb1b2
Change processGitBlameResultLine to take in String[] for compatibility
logical-1985516 96eaf57
Update blameFile to perform blame; abstract out processing in blameFile
logical-1985516 82bb6f7
Merge branch '2196-use-GitBlameLineInfo-for-aggregateBlameAuthorModif…
logical-1985516 d1a3cf8
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
logical-1985516 2ab32d3
Use getGitBlameFileResult in FileInfoAnalyzer for abstraction
logical-1985516 f843539
Merge branch '2196-use-GitBlameLineInfo-for-aggregateBlameAuthorModif…
logical-1985516 972f0e2
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
gok99 0c70dba
Replace timeOption with boolean isAuthorTime
logical-1985516 6aeb5cb
Update processGitBlameResultLine javaDoc
logical-1985516 5ed12bb
Add test cases for blameFile
logical-1985516 68c0773
Merge branch '2196-use-GitBlameLineInfo-for-aggregateBlameAuthorModif…
logical-1985516 edbc273
Fix checkStyle violations
logical-1985516 8a78498
Standardize names of test cases
logical-1985516 6089ffe
Fix checkStyle violation in test cases names
logical-1985516 623a8ab
Minor naming change isAuthorTime -> useAuthorTime
gok99 5afc311
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
gok99 174ca17
Merge branch 'master' into 2196-use-GitBlameLineInfo-for-aggregateBla…
gok99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package reposense.git; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
|
@@ -78,4 +80,50 @@ public void blameLine_nonExistentLine_throwsRunTimeException() { | |
Assertions.assertThrows(RuntimeException.class, () -> GitBlame.blameLine(config.getRepoRoot(), | ||
FAKE_AUTHOR_BLAME_TEST_FILE_COMMIT_08022018_STRING, "blameTest.java", 5)); | ||
} | ||
|
||
@Test | ||
public void blameFile_validFile_success() { | ||
List<GitBlameLineInfo> expectedLineInfos = new ArrayList<>(); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
expectedLineInfos.add(new GitBlameLineInfo("768015345e70f06add2a8b7d1f901dc07bf70582", | ||
FAKE_AUTHOR_NAME, "[email protected]", 1518085550)); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
List<GitBlameLineInfo> actualLineInfos = GitBlame.blameFile(config.getRepoRoot(), "blameTest.java", false); | ||
Assertions.assertEquals(expectedLineInfos, actualLineInfos); | ||
} | ||
|
||
@Test | ||
public void blameFile_validFileWithPreviousAuthors_success() { | ||
config.setBranch(TEST_REPO_BLAME_WITH_PREVIOUS_AUTHORS_BRANCH); | ||
GitCheckout.checkoutBranch(config.getRepoRoot(), TEST_REPO_BLAME_WITH_PREVIOUS_AUTHORS_BRANCH); | ||
createTestIgnoreRevsFile(AUTHOR_TO_IGNORE_BLAME_COMMIT_LIST_07082021); | ||
|
||
List<GitBlameLineInfo> expectedLineInfos = new ArrayList<>(); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
expectedLineInfos.add(new GitBlameLineInfo("768015345e70f06add2a8b7d1f901dc07bf70582", | ||
FAKE_AUTHOR_NAME, "[email protected]", 1518085550)); | ||
expectedLineInfos.add(new GitBlameLineInfo("8d0ac2ee20f04dce8df0591caed460bffacb65a4", | ||
MAIN_AUTHOR_NAME, "[email protected]", 1517863105)); | ||
List<GitBlameLineInfo> actualLineInfos = GitBlame.blameFile(config.getRepoRoot(), "blameTest.java", true); | ||
Assertions.assertEquals(expectedLineInfos, actualLineInfos); | ||
} | ||
|
||
@Test | ||
public void blameFile_nonExistentFile_throwsRunTimeException() { | ||
Assertions.assertThrows(RuntimeException.class, () -> GitBlame.blameFile(config.getRepoRoot(), | ||
"nonExistentFile", false)); | ||
} | ||
|
||
@Test | ||
public void blameFile_nonExistentFileWithPreviousAuthors_throwsRunTimeException() { | ||
Assertions.assertThrows(RuntimeException.class, () -> GitBlame.blameFile(config.getRepoRoot(), | ||
"nonExistentFile", true)); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add / update tests for functions / flags you've added here?