Code forensics  0.1
Generate historical information about code changes
repo_processing.hpp
Go to the documentation of this file.
1 
4 #ifndef REPO_PROCESSING_HPP
5 #define REPO_PROCESSING_HPP
6 
7 #include <mutex>
8 #include <boost/process.hpp>
9 
10 #include "common.hpp"
11 #include "git_ir.hpp"
12 #include "program_state.hpp"
13 
14 using SLock = std::scoped_lock<std::mutex>;
15 
16 auto get_nesting(CR<Str> line) -> int;
17 
20 void push_line(
21  ir::FileId id,
22  walker_state* walker,
23  CR<ir::LineData> line,
24  bool changed,
25  int period);
26 
27 ir::FileId stats_via_subprocess(
28  git_oid commit_oid,
29  walker_state* walker,
30  ir::File file,
31  CR<Str> relpath);
32 
33 ir::FileId stats_via_libgit(
34  walker_state* state,
35  git_oid commit_oid,
36  const git_tree_entry* entry,
37  CR<Str> relpath,
38  ir::File file);
39 
40 ir::FileId exec_walker(
41  git_oid commit_oid,
42  walker_state* state,
43  ir::CommitId commit,
44  const char* root,
45  const git_tree_entry* entry);
46 
47 struct SubTaskParams {
48  git_oid commit_oid;
49  ir::CommitId out_commit;
50  Str root;
52  git_tree_entry* entry;
53  int index;
54  int max_count;
55 };
56 
60 ir::CommitId process_commit(git_oid commit_oid, walker_state* state);
61 
62 void file_tasks(
63  Vec<SubTaskParams>& treewalk,
64  walker_state* state,
66  git_oid commit_oid,
67  ir::CommitId out_commit);
68 
69 void open_walker(git_oid& oid, walker_state& state);
70 
71 Vec<ir::CommitId> launch_analysis(git_oid& oid, walker_state* state);
72 
73 
74 #endif // REPO_PROCESSING_HPP
exec_walker
ir::FileId exec_walker(git_oid commit_oid, walker_state *state, ir::CommitId commit, const char *root, const git_tree_entry *entry)
SubTaskParams::entry
git_tree_entry * entry
Entry to analyze.
Definition: repo_processing.hpp:52
file_tasks
void file_tasks(Vec< SubTaskParams > &treewalk, walker_state *state, git_oid commit_oid, ir::CommitId out_commit)
SubTaskParams
Definition: repo_processing.hpp:47
stats_via_subprocess
ir::FileId stats_via_subprocess(git_oid commit_oid, walker_state *walker, ir::File file, CR< Str > relpath)
Definition: repo_processing.cpp:33
SLock
std::scoped_lock< std::mutex > SLock
Definition: repo_processing.hpp:14
ir::File
single version of the file that appeared in some commit
Definition: git_ir.hpp:135
open_walker
void open_walker(git_oid &oid, walker_state &state)
Definition: repo_processing.cpp:359
push_line
void push_line(ir::FileId id, walker_state *walker, CR< ir::LineData > line, bool changed, int period)
get_nesting
auto get_nesting(CR< Str > line) -> int
Definition: repo_processing.cpp:18
SubTaskParams::root
Str root
Root path for the analyzed entry.
Definition: repo_processing.hpp:51
walker_state
Mutable state passed around walker configurations.
Definition: program_state.hpp:199
SubTaskParams::max_count
int max_count
Maximum number of task to process.
Definition: repo_processing.hpp:54
SubTaskParams::commit_oid
git_oid commit_oid
Original git commit iD.
Definition: repo_processing.hpp:48
SubTaskParams::out_commit
ir::CommitId out_commit
Definition: repo_processing.hpp:49
program_state.hpp
Main code analysis state and configuration classes.
process_commit
ir::CommitId process_commit(git_oid commit_oid, walker_state *state)
Definition: repo_processing.cpp:286
SubTaskParams::index
int index
Task index in the global sequence.
Definition: repo_processing.hpp:53
stats_via_libgit
ir::FileId stats_via_libgit(walker_state *state, git_oid commit_oid, const git_tree_entry *entry, CR< Str > relpath, ir::File file)
Definition: repo_processing.cpp:159
git_ir.hpp
launch_analysis
Vec< ir::CommitId > launch_analysis(git_oid &oid, walker_state *state)
Definition: repo_processing.cpp:574