Code forensics
0.1
Generate historical information about code changes
|
Go to the documentation of this file. 1 #include <boost/graph/adjacency_list.hpp>
2 #include <unordered_map>
4 #include "generator.hpp"
9 using boost::add_vertex;
10 using boost::in_degree;
11 using boost::in_edges;
12 using boost::num_vertices;
13 using boost::out_degree;
14 using boost::out_edges;
17 using boost::vertices;
30 using Graph = boost::adjacency_list<
33 boost::bidirectionalS,
38 using VDesc = GraphTraits::vertex_descriptor;
39 using EDesc = GraphTraits::edge_descriptor;
43 std::unordered_map<git_oid, VDesc>
rev_map;
72 for (
auto [begin, end] = bg::in_edges(v,
g); begin != end;
79 for (
auto [begin, end] = bg::out_edges(v,
g); begin != end;
86 for (
auto [begin, end] = bg::vertices(
g); begin != end; ++begin) {
97 std::unordered_set<VDesc> tried;
99 if (tried.find(v) == tried.end()) {
bool is_merge(VDesc v) const
Definition: repo_graph.hpp:57
bool is_main
Definition: repo_graph.hpp:25
CommitEdge & operator[](EDesc e)
Definition: repo_graph.hpp:53
git_oid oid
Definition: repo_graph.hpp:21
Definition: repo_graph.hpp:7
generator< VDesc > commits() const
Definition: repo_graph.hpp:85
int out_degree(VDesc v) const
Definition: repo_graph.hpp:51
Definition: repo_graph.hpp:24
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, CommitInfo, CommitEdge > Graph
Definition: repo_graph.hpp:35
CommitGraph(git_repository *repo)
Definition: repo_graph.cpp:3
bool is_main(VDesc v) const
Definition: repo_graph.hpp:59
int in_degree(VDesc v) const
Definition: repo_graph.hpp:50
GraphTraits::vertex_descriptor VDesc
Definition: repo_graph.hpp:38
Graph g
Definition: repo_graph.hpp:41
VDesc get_desc(CR< git_oid > oid)
Definition: repo_graph.cpp:66
generator< EDesc > parent_commits(VDesc v) const
Definition: repo_graph.hpp:71
Definition: repo_graph.hpp:29
std::unordered_set< VDesc > main_set
Definition: repo_graph.hpp:44
Definition: repo_graph.hpp:20
boost::graph_traits< Graph > GraphTraits
Definition: repo_graph.hpp:37
CommitInfo & operator[](VDesc v)
Definition: repo_graph.hpp:52
generator< Pair< VDesc, Opt< VDesc > > > commit_pairs() const
iterate over pairs commit-base (in this order). Merge commits are also included in the iteration resu...
Definition: repo_graph.hpp:96
GraphTraits::edge_descriptor EDesc
Definition: repo_graph.hpp:39
Opt< VDesc > get_base(VDesc v) const
Definition: repo_graph.hpp:63
std::unordered_map< git_oid, VDesc > rev_map
Definition: repo_graph.hpp:43
VDesc operator[](CR< git_oid > oid)
Definition: repo_graph.hpp:54
VDesc target(EDesc e) const
Definition: repo_graph.hpp:56
generator< EDesc > next_commits(VDesc v) const
Definition: repo_graph.hpp:78
std::vector< VDesc > main_path
Definition: repo_graph.hpp:48
VDesc source(EDesc e) const
Definition: repo_graph.hpp:55