-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage_vs_commit.py
More file actions
40 lines (29 loc) · 849 Bytes
/
message_vs_commit.py
File metadata and controls
40 lines (29 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys
import git
from itertools import chain, imap
from os import path
import matplotlib.pyplot as plt
repo_dir = sys.argv[1]
repo_path = path.realpath(repo_dir)
repo = git.Repo(repo_path)
x_axis, y_axis = [], []
for commit in repo.iter_commits(rev='master'):
change_size = sum(
[
commit.stats.total['insertions'],
commit.stats.total['deletions'],
]
)
log_size = sum(
imap(len, chain(*commit.message.split()))
)
if change_size and log_size:
x_axis.append(change_size)
y_axis.append(log_size)
figure, axis = plt.subplots()
axis.set_xscale('log')
axis.set_yscale('log')
axis.set_xlabel('Size of the change in a commit')
axis.set_ylabel('Size of the log message in a commit')
axis.scatter(x_axis, y_axis)
figure.savefig('result.png', dpi=figure.dpi)