SlHelpers
Loading...
Searching...
No Matches
PatchesAuthors.h
1// SPDX-License-Identifier: GPL-2.0-only
2
3#pragma once
4
5#include <filesystem>
6#include <functional>
7#include <map>
8#include <string>
9
10namespace SlGit {
11class Commit;
12class Repo;
13}
14
15namespace SlKernCVS {
16
24public:
26 using Map = std::map<std::string, std::map<std::string, unsigned int>>;
28 using InsertUser = std::function<bool (const std::string &email)>;
30 using InsertUFMap = std::function<bool (const std::string &email,
31 const std::filesystem::path &file, unsigned gitFixes, unsigned realFixes)>;
32
39 PatchesAuthors(const SlGit::Repo &repo, bool dumpRefs, bool reportUnhandled) :
40 repo(&repo), dumpRefs(dumpRefs), reportUnhandled(reportUnhandled)
41 {}
42
50 bool processAuthors(const SlGit::Commit &commit, const InsertUser &insertUser,
51 const InsertUFMap &insertUFMap);
52private:
53 PatchesAuthors() : repo(nullptr), dumpRefs(false), reportUnhandled(false) {}
54 friend void testProcessPatch();
55
56 int processPatch(const std::filesystem::path &file, const std::string &content);
57
58 const SlGit::Repo *repo;
59 const bool dumpRefs;
60 const bool reportUnhandled;
61 Map m_HoH;
62 Map m_HoHReal;
63 Map m_HoHRefs;
64};
65
66}
Commit is a representation of a git commit.
Definition Commit.h:21
The most important Git class.
Definition Repo.h:45
std::map< std::string, std::map< std::string, unsigned int > > Map
E-mail -> file -> count mapping.
Definition PatchesAuthors.h:26
std::function< bool(const std::string &email)> InsertUser
A callback invoked for e-mail.
Definition PatchesAuthors.h:28
PatchesAuthors(const SlGit::Repo &repo, bool dumpRefs, bool reportUnhandled)
PatchesAuthors constructor.
Definition PatchesAuthors.h:39
bool processAuthors(const SlGit::Commit &commit, const InsertUser &insertUser, const InsertUFMap &insertUFMap)
The real work function of this class.
std::function< bool(const std::string &email, const std::filesystem::path &file, unsigned gitFixes, unsigned realFixes)> InsertUFMap
A callback invoked for e-mail, file, and counts of git-fixes and real changes.
Definition PatchesAuthors.h:30