39 |
39 |
40 // find all delimiters |
40 // find all delimiters |
41 const auto line_view = std::string_view{line}; |
41 const auto line_view = std::string_view{line}; |
42 const auto pos_delim1 = line_view.find('#', 0); |
42 const auto pos_delim1 = line_view.find('#', 0); |
43 const auto pos_delim2 = line_view.find('#', pos_delim1 + 1); |
43 const auto pos_delim2 = line_view.find('#', pos_delim1 + 1); |
|
44 const auto pos_delim3 = line_view.find('#', pos_delim2 + 1); |
44 |
45 |
45 std::string author{settings.map_author(line_view.substr(0, pos_delim1))}; |
46 std::string author{settings.map_author(line_view.substr(0, pos_delim1))}; |
46 std::string_view date_view{line_view.substr(pos_delim1+1, pos_delim2)}; |
47 std::string_view date_view{line_view.substr(pos_delim1+1, pos_delim2 - pos_delim1 - 1)}; |
47 std::string_view summary_view{line_view.substr(pos_delim2+1)}; |
48 std::string_view tags_view{line_view.substr(pos_delim2+1, pos_delim3 - pos_delim2 - 1)}; |
|
49 std::string_view summary_view{line_view.substr(pos_delim3+1)}; |
48 |
50 |
49 int year = 0; |
51 int year = 0; |
50 unsigned int month = 0, day = 0; |
52 unsigned int month = 0, day = 0; |
51 auto date_parts = std::views::split(date_view, "-"sv) |
53 auto date_parts = std::views::split(date_view, "-"sv) |
52 | std::views::transform([](auto r) { return std::string_view(r); }) |
54 | std::views::transform([](auto r) { return std::string_view(r); }) |
53 | std::ranges::to<std::vector>(); |
55 | std::ranges::to<std::vector>(); |
54 std::from_chars(date_parts[0].begin(), date_parts[0].end(), year); |
56 std::from_chars(date_parts[0].begin(), date_parts[0].end(), year); |
55 std::from_chars(date_parts[1].begin(), date_parts[1].end(), month); |
57 std::from_chars(date_parts[1].begin(), date_parts[1].end(), month); |
56 std::from_chars(date_parts[2].begin(), date_parts[2].end(), day); |
58 std::from_chars(date_parts[2].begin(), date_parts[2].end(), day); |
57 auto &[summaries] = m_heatmap[repo_key][author][chrono::year_month_day{ |
59 auto &[summaries, tags] = |
58 chrono::year{year}, chrono::month{month}, chrono::day{day} |
60 m_heatmap[repo_key][author][chrono::year_month_day{ |
59 }]; |
61 chrono::year{year}, chrono::month{month}, chrono::day{day} |
|
62 }]; |
60 summaries[m_current_repo].emplace_back(summary_view); |
63 summaries[m_current_repo].emplace_back(summary_view); |
|
64 if (!tags_view.empty()) { |
|
65 tags[m_current_repo].emplace_back(tags_view); |
|
66 } |
61 } |
67 } |
62 } |
68 } |
63 |
69 |
64 std::array<unsigned int, 12> fm::heatmap::commits_per_month( |
70 std::array<unsigned int, 12> fm::heatmap::commits_per_month( |
65 const std::string& repo, |
71 const std::string& repo, |