| 29 #include <numeric> |
29 #include <numeric> |
| 30 #include <vector> |
30 #include <vector> |
| 31 #include <string> |
31 #include <string> |
| 32 |
32 |
| 33 namespace fm { |
33 namespace fm { |
| |
34 struct commit_info final { |
| |
35 std::string hash; |
| |
36 std::string message; |
| |
37 commit_info(std::string_view hash, std::string_view message) |
| |
38 : hash{hash}, message {message} {} |
| |
39 }; |
| |
40 |
| 34 using commit_counts = std::unordered_map< |
41 using commit_counts = std::unordered_map< |
| 35 std::string, // repository name |
42 std::string, // repository name |
| 36 unsigned>; |
43 unsigned>; |
| 37 using summaries_lists = std::unordered_map< |
44 using summaries_lists = std::unordered_map< |
| 38 std::string, // repository name |
45 std::string, // repository name |
| 39 std::vector<std::string> >; |
46 std::vector<commit_info> >; |
| 40 using tag_lists = std::unordered_map< |
47 using tag_lists = std::unordered_map< |
| |
48 std::string, // repository name |
| |
49 std::vector<commit_info> >; |
| |
50 using tag_summaries = std::unordered_map< |
| 41 std::string, // repository name |
51 std::string, // repository name |
| 42 std::vector<std::string> >; |
52 std::vector<std::string> >; |
| 43 |
53 |
| 44 struct commits final { |
54 struct commits final { |
| 45 summaries_lists summaries; |
55 summaries_lists summaries; |
| 55 [](unsigned sum, const auto &pair) { return sum + pair.second.size(); }); |
65 [](unsigned sum, const auto &pair) { return sum + pair.second.size(); }); |
| 56 } |
66 } |
| 57 }; |
67 }; |
| 58 |
68 |
| 59 struct commit_summary final { |
69 struct commit_summary final { |
| 60 tag_lists tags_with_date; |
70 tag_summaries tags_with_date; |
| 61 commit_counts commits; |
71 commit_counts commits; |
| 62 |
72 |
| 63 [[nodiscard]] unsigned count(const std::string &repo) const { |
73 [[nodiscard]] unsigned count(const std::string &repo) const { |
| 64 return commits.at(repo); |
74 return commits.at(repo); |
| 65 } |
75 } |