Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Gustavo Padovan
kernel-scripts
Commits
e07658ed
Commit
e07658ed
authored
Mar 19, 2020
by
Gustavo Padovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stats: read git log from stdin
parent
046db88f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
contribution-stats.py
contribution-stats.py
+4
-13
No files found.
contribution-stats.py
View file @
e07658ed
#! /usr/bin/env python
from
pygit2
import
Repository
,
Tag
from
pygit2
import
GIT_SORT_TOPOLOGICAL
import
sys
import
csv
import
re
details
=
True
...
...
@@ -65,16 +67,8 @@ def print_commits(dict):
if
__name__
==
"__main__"
:
repo
=
Repository
(
GIT_TREE
)
first_commit
=
repo
.
revparse_single
(
'v3.12'
)
if
isinstance
(
first_commit
,
Tag
):
first_commit
=
first_commit
.
get_object
()
last_commit
=
repo
.
revparse_single
(
'HEAD'
)
if
isinstance
(
last_commit
,
Tag
):
last_commit
=
last_commit
.
get_object
()
for
commit
in
repo
.
walk
(
last_commit
.
id
,
GIT_SORT_TOPOLOGICAL
):
for
line
in
csv
.
reader
(
sys
.
stdin
,
delimiter
=
','
):
commit
=
repo
.
get
(
line
[
0
])
if
EMAIL_PATTERN
in
commit
.
author
.
email
:
add_contributor
(
contributors
,
commit
.
author
.
email
,
commit
.
author
.
name
)
add_commit
(
authored
,
commit
.
author
.
email
,
commit
)
...
...
@@ -95,9 +89,6 @@ if __name__ == "__main__":
for
m
in
match
:
add_contributor
(
contributors
,
m
[
1
],
m
[
0
])
add_commit
(
tag
[
1
],
m
[
1
],
commit
)
if
commit
.
id
==
first_commit
.
id
:
break
print
(
"# Authored (%d)
\n
"
%
total_commits
(
authored
))
print_commits
(
authored
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment