Forked From: https://github.com/ualberta-smr/refactoring-analysis-results
Python scripts to analyze MySql data generated by https://github.com/Symbolk/RefactoringsInMergeCommits, which mines merge scenarios with refactoring-related merge conflict(s) from Git repositories.
- Windows (recommended)/Linux/macOS
- Python 3.7
- MySQL 5.7
- PyCharm
-
Download the dumped data:
dumped_data/20190401.sql
; -
Start MySQL 5.7 locally, import the data into it:
mysql -u root -p Enter password: ***** mysql> CREATE DATABASE refactoring_analysis; mysql> use refactoring_analysis mysql> source 20190401.sql
-
Show studied projects:
mysql> show tables; mysql> select * from project;
-
To get the number of merge commits with commits for one project:
select * from project where name="error-prone"; select count(*) from merge_commit WHERE project_id=10 and is_conflicting=1 and timestamp < 1554048000;
1554048000 = 2019.04.01
- Open the clone repository as a project with PyCharm;
- Under the
stats/
directory of the cloned repository, run the following command in the terminal:
pip install -r requirements.txt
- Edit
database.properties
to config MySQL:
development.driver=com.mysql.jdbc.Driver
development.username=<username>
development.password=<password>
development.url=jdbc:mysql://localhost//refactoring_analysis
-
Edit the following code in
stats/refactorings_analyzer.py
to select one of the two dimensions:if __name__ == '__main__': get_overall_refactorings_num_by_refactoring_type() # get_involved_refactorings_num_by_refactoring_type()
-
Run the
main
function ofstats/refactorings_analyzer.py
to get the result csv file under thestas/results
folder. -
Visualize the results:
(a) Overall refactorings in the commit history:
(b) Involved refactorings in merge conflicts:
-
Edit the following code in
stats/data_resolver.py
to config repo information:def get_merge_scenarios_involved_refactorings(): # process one project each time repo_id = "ID" repo_name = "NAME" repo_paths = [ 'D:\\github\\repos\\'+repo_name ] csv_path = 'merge_scenarios_involved_refactorings_' + repo_name + '.csv'
-
Run the
main
function ofstats/data_resolver.py
to get the csv file, which contains a summary of the collected data:
Run stats/runtimes.py
with the stats/runtimes.csv
file as the input, which is generated by evaluation programs in https://github.com/Symbolk/IntelliMerge.
Average running time:
IntelliMerge 1237.5151856017999ms
jFSTMerge 1932.0837642192348ms
Median running time:
IntelliMerge 367.0ms
jFSTMerge 1373.0ms