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 std::filesystem::path &&file,
32 unsigned gitFixes, unsigned realFixes)>;
33
40 PatchesAuthors(const SlGit::Repo &repo, bool dumpRefs, bool reportUnhandled) :
41 repo(&repo), dumpRefs(dumpRefs), reportUnhandled(reportUnhandled)
42 {}
43
51 bool processAuthors(const SlGit::Commit &commit, const InsertUser &insertUser,
52 const InsertUFMap &insertUFMap);
53private:
54 PatchesAuthors() : repo(nullptr), dumpRefs(false), reportUnhandled(false) {}
55 friend void testProcessPatch();
56
57 int processPatch(const std::filesystem::path &file, const std::string &content);
58
59 const SlGit::Repo *repo;
60 const bool dumpRefs;
61 const bool reportUnhandled;
62 Map m_HoH;
63 Map m_HoHReal;
64 Map m_HoHRefs;
65};
66
67}
Commit is a representation of a git commit.
Definition Commit.h:21
The most important Git class.
Definition Repo.h:45
std::function< bool(const std::string &email, 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
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:40
bool processAuthors(const SlGit::Commit &commit, const InsertUser &insertUser, const InsertUFMap &insertUFMap)
The real work function of this class.