-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bachlorthesis Friedel #659
Draft
Sinerum
wants to merge
216
commits into
vara-dev
Choose a base branch
from
BachlorThesisFriedel
base: vara-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 151 commits
Commits
Show all changes
216 commits
Select commit
Hold shift + click to select a range
3398096
Merge vara-dev
Sinerum e8ebc4a
merge vara-dev
Sinerum 96ea94a
add lines of code database and add plot comparing interactions and li…
Sinerum 8bfedfe
make the interaction line comparison plot nicer
Sinerum d680703
Add plots comparing author contribution of lines and interactions
Sinerum b1aa3a9
Add commit evolution plot
Sinerum 8e0593b
Add calc missing revisions for most of the new plots
Sinerum da4d951
fix format of commit-structure plot
Sinerum f13a65a
turn commit_structure plot into a scatter plot
Sinerum d08900c
color base_hashes acording to their author
Sinerum 0e56b14
add legend for author colors
Sinerum 99c178a
Clean up plots
Sinerum 1d5416b
remove the restriction of the case_study from the data and only use i…
Sinerum 63e2033
Pull in new BenchBuild version 6.3 (#597)
vulder 9f45cdf
Implements a paper config specific git filter (#596)
vulder 0dcd11c
Adds perf_tests into bb_config generation (#599)
vulder 8331a0a
Fixes typos in documentation and adds required packages for arch and …
jonas-kaufmann cb82ab8
Implements code only revision sampling (#601)
vulder f9a9c23
Allow to build research tools in container. (#595)
boehmseb f05bed2
Implements revisions selection based on a time range (#602)
vulder 79c3079
Add possibility to attach converters to CLI options. (#605)
boehmseb 918fc07
Implement vara-cs cleanup all (#603)
Sinerum 28c871d
Fix type error in `vara-cs package`. (#606)
boehmseb d4b2315
Fixes timestamp based revision sampling (#607)
vulder ef42cf9
Ignore blocked revisions by default (#608)
vulder 022111a
Plot rework for the verifier-opt-plot (#527)
cormensratio 2d9a654
Plot rework for the verifier-no-opt-plot (#526)
cormensratio a5cd4eb
Adds utility for automatic zipped report folders (#609)
vulder 96208a4
Gracefully exit vara-run should benchbuild fail (#615)
vulder 827e029
Adds blame interaction graphs (#452)
boehmseb 4e90441
SZZ quality metric database + table (#477)
boehmseb 125a5ef
Reintroduces verifier-opt-plot generator (#613)
cormensratio 0e6ef5d
Fixes vara-cs view; using the user selected report type (#616)
vulder d20eb13
Bump version to 11.1.2
vulder aad09db
Bump version to 11.1.3
vulder 1dc2fa1
Extends release docs with more details (#617)
vulder 4e318cf
Refactor the constructor of the Plot class (#620)
Sinerum f992d50
Ports old format code to f-strings (#619)
Sinerum fc775ab
Remove unused imports (#624)
LuAbelt 1fe8cb8
Additional verification for VaRA in buildsetup (#621)
LuAbelt 1d28414
Avoid unnecessary git fetch and clone calls. (#622)
boehmseb 84d755e
Removed check_required_args (#623)
LuAbelt 9df6bd2
Implements concurrent multi report loading function (#625)
vulder 5fcafdc
Added option to bb config generation to include test_projects (#627)
LuAbelt 7cefce6
Changed old se-passau github links to new se-sic (#628)
LuAbelt aa3c326
Fixes multiple mypy issues (#626)
vulder 9422d43
Pull project repository before generating CaseStudy (#604)
Sinerum 6073dff
Implements basic experiment to measure white-box feature performance …
vulder db960f9
Report aggregates for time and TEF (#631)
jonas-kaufmann 4fbbdaa
Improves varats/VaRA documentation (#635)
vulder f721d1c
Fix vara container install check to not run vara outside container (#…
boehmseb 242ea80
Set mounting parameters according to the Buildah version when buildi…
Sinerum ce2fdc8
Introduces better VaRA documentation (#636)
vulder d37daeb
Create seperate Module for basic git command wrapper (#629)
Sinerum c382809
Pin crypto lib to older version to prevent import cycle (#637)
vulder faf0316
Rework table architecture (#618)
cormensratio 74b5230
Adapt plots to changes in the api
Sinerum b93c49f
make ylables ShortCommit hashes
Sinerum 176d9fd
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum e179a4e
add more customize ability to my plots
Sinerum 3551433
Adds more documentation for VaRA (#641)
vulder 2c81653
Changes contains_source_code to use git show (#639)
Sinerum 98905e6
Remove extra_test.sh from ci (#638)
Sinerum 54eec84
USDT execution stats experiment, projects gzip and bzip2 (#642)
jonas-kaufmann 902f221
Merge vara-dev
Sinerum e1718a3
merge vara-dev
Sinerum d27d535
Adds perf_tests into bb_config generation (#599)
vulder b499a85
Implements code only revision sampling (#601)
vulder 5fec43c
Adds blame interaction graphs (#452)
boehmseb 5b60716
Additional verification for VaRA in buildsetup (#621)
LuAbelt 6b9a05c
Pull project repository before generating CaseStudy (#604)
Sinerum e3bd106
Create seperate Module for basic git command wrapper (#629)
Sinerum b2eaaeb
Adapt plots to changes in the api
Sinerum 1bb8b26
make author coloration more clear
Sinerum dbadab1
revert changes to the calc surviving lines function made by merging
Sinerum f4aba1f
make the cells of the plot not square
Sinerum 789a0aa
cleanup some of the plots
Sinerum 962135a
convert most pandas operations to inplace to save memory
Sinerum 1756470
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 9429b06
rework commit_structure plot to show total loc and interactions at sa…
Sinerum a73a4ec
adapt survivng_lines_database to the new database type style
Sinerum 5d7a571
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 9c05929
Add function interaction graph
Sinerum 91a1167
Bump version to 11.1.4
vulder 7b49d37
Update projects.rst (#662)
bnico99 5587ce3
Adds table to compare `TimeReportAggregate` stats between multiple ex…
jonas-kaufmann b5ddf69
Table/Plot related fixes and improvements (#666)
boehmseb 5215ddb
Pin new BB version (#670)
vulder 6ed9efa
Fix docs build error caused by issues with the _typeshed module (#671)
boehmseb 8a9376d
Bump version to 11.1.5
vulder f405d26
Use experiment type in addition to report type for result file select…
boehmseb 91a807b
Draft config filename interface ideas (#669)
vulder f4b25ef
Extract author and commit counting functions to git_utils.py (#676)
boehmseb 920cd76
Fixes click experiment selection (#674)
vulder 1409928
Bump to develop LLVM-14 vara version (#678)
vulder 0839eca
Fixes imports to enable doc building (#675)
vulder 36f8d90
Adds vara/vara-llvm upgrade instructions into docs (#679)
vulder a689a4e
Fix VaRA upgrade version check (#677)
boehmseb 2f52b2e
Support non-master branches (#672)
bnico99 a7b87d8
Makes pylintrc compatible with new pylint version (#680)
vulder b94b945
Adds workload support to varats (#667)
vulder bbf55a2
Fix typo in docs (#683)
danjujan e543f5e
Fix OpenSSL configure step for certain revisions. (#682)
boehmseb daa6c66
Add blame meta-data rewrite flags to blame report experiment. (#684)
boehmseb 3292051
Removes old cryptography dep as the cycle is removed (#686)
vulder eebeaff
Adds fast_downward as new project (#663)
bnico99 af988d8
Add support for lightweight and annotated tags (#690)
bnico99 f596314
Implements error status tracking for zipped reports (#691)
vulder 8460118
Add hypre project (#689)
bnico99 7bf608c
Fixes doc building errors due to cryptography cycles (#692)
vulder a394ccd
Add clasp project (#688)
bnico99 ca3cf03
Add z3 project (#687)
bnico99 6574410
Adds example workload for FPerfCSCollection (#685)
vulder b444165
Merge vara-dev
Sinerum 4314ed1
merge vara-dev
Sinerum a687e6f
Implements basic experiment to measure white-box feature performance …
vulder d6e7e5f
Pin crypto lib to older version to prevent import cycle (#637)
vulder aaf7189
Merge vara-dev
Sinerum 2bac5f6
merge vara-dev
Sinerum 74bf09e
revert unwanted changes from merge
bdf8b2e
Fix plot config usage
Sinerum 2cfb49a
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum c4db13d
remove code that was accidentally added while merging
Sinerum 4b4fda9
Update varats-core/varats/utils/git_util.py
Sinerum 01adeb8
Update varats-core/varats/utils/git_util.py
Sinerum db0f0ca
remove old table and fix tick format for plot
Sinerum 54fe851
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum fab4b7a
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum b132245
add type hints
Sinerum daedffc
add trendline plot
Sinerum 2ebab9b
use ReportFilename for report_belongs to experiment and make blame_re…
Sinerum 237fb8f
fix usage of ReportFilname in usage of file_belongs_to_experiment
Sinerum 15b9e4c
separate commit survival and commit trend plots
Sinerum c566040
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 17ede0b
cleanup
Sinerum 33daedd
add author trend plot
Sinerum 5953dc4
use new RepositoryAtCommit context handler in calc lines per commit
Sinerum 1bb997f
use new RepositoryAtCommit context handler in calc lines per commit
Sinerum fe233b5
fix type error
Sinerum c716911
add proper commit_survival table
28cb440
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 5838261
add non normalized commit trend and commit trend using the diff betw…
11e700a
add more trend plots
Sinerum 97dc291
plot stand fosd
Sinerum 1987f38
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 5b5aa15
add commit_interaction_aggregate_database to aggregate interactions o…
Sinerum 9dbe5de
add cleanup imports
Sinerum 0b62a72
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum fe3816b
show additional project information in cs gui
Sinerum 7770cc4
add some docu to my data functions
Sinerum 2357c5a
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 5d0027b
add revision based compile to libxml2 for versions without cmake
Sinerum 57267f6
add container tio z3
Sinerum f3e55e5
add container to bzip2
Sinerum c106f39
add container to hypre
Sinerum d482d83
add container to git
Sinerum d8cd267
add dependencies to git container
Sinerum 38f9af4
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 9a59f8a
fix tables with multi case study requirement
Sinerum cb74d80
add impact plots
Sinerum 3e54306
add revision based compile functions and containers to bzip2
Sinerum 1b7805c
fix revision base binaries for bzip2
Sinerum 33cc34b
use type revision range for bzip revision based compilation
Sinerum 808d12b
fix bzips revision based compile
Sinerum b31f71e
add asterisk project file
d95d4b7
add asterisk project to bb_config
2e699a0
add opencv project
adcf0bb
fix bb_conf entry for opencv
ad59dd9
fix docstring and unsude imports for opencv.py and asterisk.py
c0509ce
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 570f9c6
fix opencv binary verification
Sinerum 70bb894
add impact correlation table
Sinerum 2170847
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 8a62a95
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 5b17993
add missing commits method to interaction scater plot
Sinerum 5a9d88f
use new author uniquification for author plots
Sinerum 82ad5a0
fix types in calc_surviving_lines
4965fc8
add author_interactions_database.py to pre calculate author interacti…
ab5a944
change contribution plots to a stacked plot
Sinerum b9d6ef7
add table for high impact revisions
Sinerum faf3ba0
use correct update function for name and mail_address sets to update …
Sinerum 14eaab5
adapt to name cleanup of author.id
Sinerum 95988f6
add sqlite as project
Sinerum 0efe7ec
change author map generation to take project name6
Sinerum 735c819
add RevisionImpact calc missing revisions
Sinerum 69548e3
add RevisionImpact Distribution table
Sinerum fa4e4f0
adapt author map tests to new generation method
Sinerum c2781d0
adapt author plot and database to new author map generation
Sinerum de2d0be
generate plots for multiple case-studies at once6
Sinerum be7eada
fix calc surviving lines
Sinerum 06e2abe
Merge branch 'vara-dev' into BachlorThesisFriedel
Sinerum 2e5dd82
add case_study overview to gui
Sinerum 3577f7c
make author_contribution_survival generate plots for multiple case st…
Sinerum 92b3041
handle uncommited changes and unknown authors in author_interactions_…
Sinerum b1339fd
make is_experiment_excluded public
Sinerum f0b855c
combine interactions and lines per commit methods as both databases w…
Sinerum 4d28f40
add hh as cpp file extension
Sinerum 2cd1ca2
improve revision impact tables and plots
Sinerum 8dea5ad
add option to disable individual kdes in scatter_plot_utils.py
Sinerum d8930b0
make single commit plot generate for multiple revisions
Sinerum d179d9e
add table for evolution of individual commits
Sinerum f522fd2
make auhtor contribution plot nice
Sinerum 5b192d9
cleanup plots
Sinerum f7b2e7d
Cleanup plot lables
7d11b43
Cleanup author_contribution_survival.py
b5f82b2
Cleanup change map plots
26276ca
Remove tables
e7cf788
Cleanup revision_impact.py
e2b23d8
add simple test for calc_surviving lines
Sinerum 1022b04
make cleanup author contribution plots
Sinerum 6138f5d
make author interaction database compatible with old reports
Sinerum 040c6d0
make revision for calc_surviving_lines optional use Head if None
Sinerum 5249269
cleanup revision impact plots
Sinerum a41ed86
Cleanup interaction change distribution plots
Sinerum 83d841b
add experiment success data tocs_metrics table
Sinerum ea69039
cleanup
Sinerum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from pathlib import Path | ||
from types import TracebackType | ||
|
||
import numpy | ||
import pygit2 | ||
from benchbuild.utils.cmd import git, grep | ||
from plumbum import local, TF, RETCODE | ||
|
@@ -37,7 +38,7 @@ class CommitHash(abc.ABC): | |
|
||
def __init__(self, short_commit_hash: str): | ||
if not len(short_commit_hash) >= self.hash_length(): | ||
raise ValueError("Commit hash too short") | ||
raise ValueError(f"Commit hash too short {short_commit_hash}") | ||
self.__commit_hash = short_commit_hash[:self.hash_length()] | ||
|
||
@property | ||
|
@@ -474,7 +475,7 @@ class Language(Enum): | |
value: tp.Set[str] # pylint: disable=invalid-name | ||
|
||
C = {"h", "c"} | ||
CPP = {"h", "hxx", "hpp", "cxx", "cpp"} | ||
CPP = {"h", "hxx", "hpp", "cxx", "cpp", "cc"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
def __init__(self) -> None: | ||
self.__enabled_languages: tp.List[ChurnConfig.Language] = [] | ||
|
@@ -1133,15 +1134,17 @@ def branch_has_upstream( | |
return tp.cast(bool, exit_code == 0) | ||
|
||
|
||
class RepositoryAtCommit(): | ||
class RepositoryAtCommit: | ||
"""Context manager to work with a repository at a specific revision, without | ||
duplicating the repository.""" | ||
|
||
def __init__(self, project_name: str, revision: ShortCommitHash) -> None: | ||
self.__repo = pygit2.Repository( | ||
get_local_project_git_path(project_name) | ||
) | ||
self.__initial_head = self.__repo.head | ||
|
||
self.__initial_head: pygit2.Reference = self.__repo.head | ||
print(self.__initial_head.name) | ||
self.__revision = self.__repo.get(revision.hash) | ||
|
||
def __enter__(self) -> Path: | ||
|
@@ -1153,4 +1156,46 @@ def __exit__( | |
exc_value: tp.Optional[BaseException], | ||
exc_traceback: tp.Optional[TracebackType] | ||
) -> None: | ||
self.__repo.checkout(self.__initial_head) | ||
self.__repo.checkout( | ||
self.__initial_head, strategy=pygit2.GIT_CHECKOUT_FORCE | ||
) | ||
|
||
|
||
def calc_surviving_lines(project_name: str, revision: CommitHash) -> \ | ||
tp.Dict[str, int]: | ||
""" | ||
Sinerum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Args: | ||
project_name: project to analyze | ||
revision: revision to analyze at | ||
|
||
returns: number of lines per prior commit | ||
""" | ||
churn_config = ChurnConfig.create_c_style_languages_config() | ||
file_pattern = re.compile( | ||
"|".join(churn_config.get_extensions_repr(r"^.*\.", r"$")) | ||
) | ||
revision = revision.to_short_commit_hash() | ||
lines_per_revision: dict = {} | ||
print(revision) | ||
with RepositoryAtCommit(project_name, revision) as project_path: | ||
print(project_path) | ||
with local.cwd(project_path): | ||
files = git("ls-tree", "-r", "--name-only", | ||
revision.hash).splitlines() | ||
|
||
for file in files: | ||
if file_pattern.match(file): | ||
lines = git("blame", "--root", "-l", f"{file}").splitlines() | ||
for line in lines: | ||
if line: | ||
last_change = line[:FullCommitHash.hash_length()] | ||
last_change = FullCommitHash(last_change) | ||
if lines_per_revision.keys( | ||
).__contains__(last_change): | ||
lines_per_revision[ | ||
last_change | ||
] = lines_per_revision[last_change] + 1 | ||
else: | ||
lines_per_revision[last_change] = 1 | ||
return lines_per_revision |
101 changes: 101 additions & 0 deletions
101
varats/varats/data/databases/commit_interaction_aggregate_database.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import typing as tp | ||
|
||
import pandas as pd | ||
|
||
from varats.data.cache_helper import build_cached_report_table | ||
from varats.data.databases.evaluationdatabase import EvaluationDatabase | ||
from varats.data.reports.blame_report import ( | ||
gen_base_to_inter_commit_repo_pair_mapping, | ||
) | ||
from varats.experiments.vara.blame_report_experiment import ( | ||
BlameReportExperiment, | ||
) | ||
from varats.jupyterhelper.file import load_blame_report | ||
from varats.mapping.commit_map import CommitMap | ||
from varats.paper.case_study import CaseStudy | ||
from varats.paper_mgmt.case_study import get_case_study_file_name_filter | ||
from varats.report.report import ReportFilepath | ||
from varats.revision.revisions import ( | ||
get_processed_revisions_files, | ||
get_failed_revisions_files, | ||
) | ||
from varats.utils.git_util import FullCommitHash | ||
|
||
|
||
class SurvivingInteractionsDatabase( | ||
EvaluationDatabase, | ||
cache_id="survivng_interactions_data", | ||
column_types={ | ||
"base_hash": 'str', | ||
"interactions": 'int32', | ||
} | ||
): | ||
"""Provides access to total interactions of commits.""" | ||
|
||
@classmethod | ||
def _load_dataframe( | ||
cls, project_name: str, commit_map: CommitMap, | ||
case_study: tp.Optional[CaseStudy], **kwargs: tp.Dict[str, tp.Any] | ||
) -> pd.DataFrame: | ||
|
||
def create_dataframe_layout() -> pd.DataFrame: | ||
df_layout = pd.DataFrame(columns=cls.COLUMNS) | ||
df_layout = df_layout.astype(cls.COLUMN_TYPES) | ||
return df_layout | ||
|
||
def create_data_frame_for_report( | ||
report_path: ReportFilepath | ||
) -> tp.Tuple[pd.DataFrame, str, str]: | ||
report = load_blame_report(report_path) | ||
base_inter_c_repo_pair_mapping = \ | ||
gen_base_to_inter_commit_repo_pair_mapping(report) | ||
revision = report.head_commit | ||
|
||
def build_dataframe_row(chash: FullCommitHash, | ||
interactions: int) -> tp.Dict[str, tp.Any]: | ||
|
||
data_dict: tp.Dict[str, tp.Any] = { | ||
'revision': revision.hash, | ||
'time_id': commit_map.short_time_id(revision), | ||
'base_hash': chash.hash, | ||
'interactions': interactions | ||
} | ||
return data_dict | ||
|
||
result_data_dicts: tp.List[tp.Dict[str, tp.Any]] = [] | ||
|
||
for base_pair in base_inter_c_repo_pair_mapping: | ||
inter_pair_amount_dict = base_inter_c_repo_pair_mapping[ | ||
base_pair] | ||
interactions_amount = sum(inter_pair_amount_dict.values()) | ||
result_data_dicts.append( | ||
build_dataframe_row( | ||
chash=base_pair.commit.commit_hash, | ||
interactions=interactions_amount | ||
) | ||
) | ||
return pd.DataFrame(result_data_dicts | ||
), report.head_commit.hash, str( | ||
report_path.stat().st_mtime_ns | ||
) | ||
|
||
report_files = get_processed_revisions_files( | ||
project_name, | ||
BlameReportExperiment, | ||
file_name_filter=get_case_study_file_name_filter(case_study) | ||
) | ||
|
||
failed_report_files = get_failed_revisions_files( | ||
project_name, | ||
BlameReportExperiment, | ||
file_name_filter=get_case_study_file_name_filter(case_study) | ||
) | ||
|
||
data_frame = build_cached_report_table( | ||
cls.CACHE_ID, project_name, report_files, failed_report_files, | ||
create_dataframe_layout, create_data_frame_for_report, | ||
lambda path: path.report_filename.commit_hash.hash, | ||
lambda path: str(path.stat().st_mtime_ns), | ||
lambda a, b: int(a) > int(b) | ||
) | ||
return data_frame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import typing as tp | ||
|
||
import pandas as pd | ||
from pygit2._pygit2 import GIT_SORT_TOPOLOGICAL | ||
|
||
from varats.data.cache_helper import load_cached_df_or_none, cache_dataframe | ||
from varats.data.databases.evaluationdatabase import EvaluationDatabase | ||
from varats.mapping.commit_map import CommitMap | ||
from varats.paper.case_study import CaseStudy | ||
from varats.project.project_util import get_local_project_git | ||
from varats.utils.git_util import ( | ||
calc_surviving_lines, | ||
FullCommitHash, | ||
ShortCommitHash, | ||
) | ||
|
||
|
||
class SurvivingLinesDatabase( | ||
EvaluationDatabase, | ||
cache_id="survivng_lines_data", | ||
column_types={ | ||
"commit_hash": 'str', | ||
"lines": 'int32' | ||
} | ||
): | ||
|
||
@classmethod | ||
def _load_dataframe( | ||
cls, project_name: str, commit_map: CommitMap, | ||
case_study: tp.Optional[CaseStudy], **kwargs: tp.Dict[str, tp.Any] | ||
) -> pd.DataFrame: | ||
data_frame = load_cached_df_or_none( | ||
cls.CACHE_ID, project_name, cls.COLUMN_TYPES | ||
) | ||
project_repo = get_local_project_git(case_study.project_name) | ||
revisions = case_study.revisions if case_study else [ | ||
FullCommitHash.from_pygit_commit(commit) for commit in | ||
project_repo.walk(project_repo.head.target, GIT_SORT_TOPOLOGICAL) | ||
] | ||
data_dicts: tp.List[tp.Dict[str, tp.Any]] = [] | ||
cached_revisions = data_frame.groupby("revision").groups.keys( | ||
) if data_frame is not None else set() | ||
revisions_to_compute: tp.Set[str] = set( | ||
map(lambda r: r.hash, revisions) | ||
) - cached_revisions | ||
|
||
for revision in revisions_to_compute: | ||
lines_per_commit = calc_surviving_lines( | ||
case_study.project_name, ShortCommitHash(revision) | ||
) | ||
|
||
def build_dataframe_row(chash: FullCommitHash, | ||
lines: int) -> tp.Dict[str, tp.Any]: | ||
data_dict: tp.Dict[str, tp.Any] = { | ||
'revision': revision, | ||
'time_id': commit_map.time_id(FullCommitHash(revision)), | ||
'commit_hash': chash.hash, | ||
'lines': lines | ||
} | ||
return data_dict | ||
|
||
for entry in lines_per_commit.items(): | ||
data_dicts.append(build_dataframe_row(entry[0], entry[1])) | ||
if data_frame is None: | ||
data_frame = pd.DataFrame(data_dicts) | ||
else: | ||
data_frame = pd.concat([data_frame, | ||
pd.DataFrame(data_dicts)], | ||
ignore_index=True, | ||
copy=False) | ||
cache_dataframe(cls.CACHE_ID, project_name, data_frame) | ||
return data_frame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you like, these changes are quite useful and could already be integrated into
dev
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You integrate these two changes to
dev
please.