Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: tests/git_common_test.py

Issue 1559943003: Added git hyper-blame, a tool that skips unwanted commits in git blame. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix comment. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/git_common_test.py
diff --git a/tests/git_common_test.py b/tests/git_common_test.py
index 76a91520dcee4ec73a67d31385725665ac6be6c0..25b8dc77b05747490a5d692167dc0dce9db755b3 100755
--- a/tests/git_common_test.py
+++ b/tests/git_common_test.py
@@ -176,15 +176,15 @@ class GitReadOnlyFunctionsTest(git_test_utils.GitRepoReadOnlyTestBase,
COMMIT_C = {
'some/files/file2': {
'mode': 0755,
- 'data': 'file2 - vanilla'},
+ 'data': 'file2 - vanilla\n'},
}
COMMIT_E = {
- 'some/files/file2': {'data': 'file2 - merged'},
+ 'some/files/file2': {'data': 'file2 - merged\n'},
}
COMMIT_D = {
- 'some/files/file2': {'data': 'file2 - vanilla\nfile2 - merged'},
+ 'some/files/file2': {'data': 'file2 - vanilla\nfile2 - merged\n'},
}
def testHashes(self):
@@ -259,6 +259,18 @@ class GitReadOnlyFunctionsTest(git_test_utils.GitRepoReadOnlyTestBase,
self.repo.git('config', 'branch.master.dormant', 'true')
self.assertTrue(self.repo.run(self.gc.is_dormant, 'master'))
+ def testBlame(self):
+ # Expect to blame line 1 on C, line 2 on E.
+ c_short = self.repo['C'][:8]
+ c_author = self.repo.show_commit('C', format_string='%an %ai')
+ e_short = self.repo['E'][:8]
+ e_author = self.repo.show_commit('E', format_string='%an %ai')
+ expected_output = ['%s (%s 1) file2 - vanilla' % (c_short, c_author),
+ '%s (%s 2) file2 - merged' % (e_short, e_author)]
+ self.assertEqual(expected_output,
+ self.repo.run(self.gc.blame, 'some/files/file2',
+ 'tag_D').split('\n'))
+
def testParseCommitrefs(self):
ret = self.repo.run(
self.gc.parse_commitrefs, *[

Powered by Google App Engine
This is Rietveld 408576698