Added ability to print file paths with bug numbers
diff --git a/git.py b/git.py
index 3fe5137..5bebd3f 100644
--- a/git.py
+++ b/git.py
@@ -254,3 +254,17 @@
bug_fix_file_tree = BugFixFileTree()
bug_fix_file_tree.build_from_path_to_bug_list_map(path_to_bug_list_map)
bug_fix_file_tree.print()
+
+def print_file_paths_with_bug_numbers(git: Git, path_to_bug_list_file: str) -> None:
+ path_to_bug_list_map = path_to_bug_list_map_from_file(path_to_bug_list_file)
+ path_to_bug_number = {}
+ for path, bug_list in path_to_bug_list_map._path_to_bug_list_map.items():
+ for bug_hash in bug_list:
+ path_to_bug_number.setdefault(path, 0)
+ path_to_bug_number[path] += 1
+ path_to_bug_number_list = list(path_to_bug_number.items())
+ path_to_bug_number_list.sort(key=lambda pair: pair[1], reverse=True)
+ for path_bug_number_pair in path_to_bug_number_list:
+ path = path_bug_number_pair[0]
+ bug_number = path_bug_number_pair[1]
+ print(path, ', ', bug_number)
diff --git a/heat_map_builder.py b/heat_map_builder.py
index dbafe44..bafea0b 100755
--- a/heat_map_builder.py
+++ b/heat_map_builder.py
@@ -27,6 +27,9 @@
elif argv[0] == 'print_heat_map':
assert len(argv) > 1
git.print_heat_map(git_obj, argv[1])
+ elif argv[0] == 'print_file_paths_with_bug_numbers':
+ assert len(argv) > 1
+ git.print_file_paths_with_bug_numbers(git_obj, argv[1])
else:
assert False