Code forensics  0.1
Generate historical information about code changes
walker_state Struct Reference

Mutable state passed around walker configurations. More...

#include <program_state.hpp>

Collaboration diagram for walker_state:

Public Member Functions

void add_full_commit (CR< git_oid > oid, int period)
 
void add_id_mapping (CR< git_oid > oid, ir::CommitId id)
 
ir::CommitId get_id (CR< git_oid > oid)
 
Opt< int > get_period (CR< git_oid > commit) const noexcept
 
int get_period (CR< git_oid > commit, CR< git_oid > line) const noexcept
 get period the line was attributed to, otherwise fall back to the commit period More...
 
auto consider_changed (CR< git_oid > commit_id, CR< git_oid > line_change_id) const -> bool
 

Public Attributes

CP< walker_configconfig
 
git_revwalk * walker
 
git_repository * repo
 Current git repository. More...
 
Vec< git_oid > full_commits
 Ordered list of commits that were considered for the processing run. More...
 
std::unordered_map< git_oid, ir::CommitId > commit_ids
 
std::unordered_map< git_oid, int > rev_index
 
std::unordered_map< git_oid, int > rev_periods
 Mapping from the commits to the analysis periods they are in. More...
 
std::unordered_map< git_oid, ir::CommitId > sampled_commits
 List of commits that were selected for the processing run. More...
 
std::mutex m
 common mutex for synchronizing content manager mutations More...
 
ir::content_managercontent
 
SPtr< Loggerlogger
 main application logger entry More...
 

Detailed Description

Mutable state passed around walker configurations.

Member Function Documentation

◆ add_full_commit()

void walker_state::add_full_commit ( CR< git_oid >  oid,
int  period 
)
inline

Add preiod mapping of the commit to the walker. All information about line's origin period in further analysis will be based on the data provided to to this functino.

Parameters
oidgit ID of the commit
periodPeriod ID that this commit belongs to

◆ add_id_mapping()

void walker_state::add_id_mapping ( CR< git_oid >  oid,
ir::CommitId  id 
)
inline

◆ consider_changed()

auto walker_state::consider_changed ( CR< git_oid >  commit_id,
CR< git_oid >  line_change_id 
) const -> bool
inline

Whether to consider commit referred to by

  • commit_id has changed in the same period as the line (
  • line_changed_id).

If line comes from an unknow commit (different branch for example) it is considered changed.

◆ get_id()

ir::CommitId walker_state::get_id ( CR< git_oid >  oid)
inline

◆ get_period() [1/2]

Opt<int> walker_state::get_period ( CR< git_oid >  commit) const
inlinenoexcept

Get period that commit is attributed to. May return 'none' option for commits that were not registered in the revese period index - ones that come from a different branch that we didn't iterate over.

◆ get_period() [2/2]

int walker_state::get_period ( CR< git_oid >  commit,
CR< git_oid >  line 
) const
inlinenoexcept

get period the line was attributed to, otherwise fall back to the commit period

Member Data Documentation

◆ commit_ids

std::unordered_map<git_oid, ir::CommitId> walker_state::commit_ids

◆ config

CP<walker_config> walker_state::config

◆ content

ir::content_manager* walker_state::content

◆ full_commits

Vec<git_oid> walker_state::full_commits

Ordered list of commits that were considered for the processing run.

◆ logger

SPtr<Logger> walker_state::logger

main application logger entry

◆ m

std::mutex walker_state::m

common mutex for synchronizing content manager mutations

◆ repo

git_repository* walker_state::repo

Current git repository.

◆ rev_index

std::unordered_map<git_oid, int> walker_state::rev_index

Mapping from the commit id to it's position in the whole list of considered commits

◆ rev_periods

std::unordered_map<git_oid, int> walker_state::rev_periods

Mapping from the commits to the analysis periods they are in.

◆ sampled_commits

std::unordered_map<git_oid, ir::CommitId> walker_state::sampled_commits

List of commits that were selected for the processing run.

◆ walker

git_revwalk* walker_state::walker

The documentation for this struct was generated from the following file: