Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Philipp Wolfer
funkwhale
Commits
dfef5e38
Verified
Commit
dfef5e38
authored
May 16, 2019
by
Eliot Berriot
Browse files
Added contributions script and contributors to the changelog
parent
e99b7703
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
dfef5e38
...
...
@@ -199,6 +199,36 @@ Documentation:
- Document how to use Redis over unix sockets (#770)
Contributors to this release (commiters and translators):
- Ale London
- Alexander
- Ben Finney
- ButterflyOfFire
- Ciarán Ainsworth
- Damien Nicolas
- Daniele Lira Mereb
- Eliot Berriot
- Elza Gelez
- gerry_the_hat
- gordon
- interfect
- jake
- Jee
- jovuit
- Mélanie Chauvel
- nouts
- Pierrick
- Qasim Ali
- Quentí
- Renon
- Rodrigo Leite
- Sylke Vicious
- Thomas Brockmöller
- Tixie
- Vierkantor
- Von
- Zach Halasz
0.18.3 (2019-03-21)
-------------------
...
...
scripts/get-contributions-stats.py
0 → 100644
View file @
dfef5e38
import
argparse
import
requests
GITLAB_URL
=
"https://dev.funkwhale.audio"
GITLAB_PROJECT_ID
=
17
WEBLATE_URL
=
"https://translate.funkwhale.audio"
WEBLATE_COMPONENT_ID
=
"funkwhale/front"
def
get_commits
(
ref_name
,
since
):
url
=
GITLAB_URL
+
"/api/v4/projects/{}/repository/commits"
.
format
(
GITLAB_PROJECT_ID
)
while
url
:
response
=
requests
.
get
(
url
,
params
=
{
"since"
:
since
,
"ref_name"
:
ref_name
,
"per_page"
:
100
}
)
response
.
raise_for_status
()
yield
from
response
.
json
()
if
"next"
in
response
.
links
:
url
=
response
.
links
[
"next"
][
"url"
]
else
:
url
=
None
def
get_commit_stats
(
commits
):
stats
=
{
"total"
:
0
,
"commiters"
:
{}}
for
commit
in
commits
:
if
commit
[
"message"
].
startswith
(
"Merge branch "
):
continue
stats
[
"total"
]
+=
1
try
:
stats
[
"commiters"
][
commit
[
"author_name"
]]
+=
1
except
KeyError
:
stats
[
"commiters"
][
commit
[
"author_name"
]]
=
1
return
stats
def
get_tag_date
(
ref
):
url
=
GITLAB_URL
+
"/api/v4/projects/{}/repository/tags/{}"
.
format
(
GITLAB_PROJECT_ID
,
ref
)
response
=
requests
.
get
(
url
)
response
.
raise_for_status
()
data
=
response
.
json
()
return
data
[
"commit"
][
"committed_date"
]
def
get_translations
(
since
):
url
=
WEBLATE_URL
+
"/api/components/{}/changes/"
.
format
(
WEBLATE_COMPONENT_ID
)
while
url
:
response
=
requests
.
get
(
url
)
response
.
raise_for_status
()
if
"next"
in
response
.
json
():
url
=
response
.
json
()[
"next"
]
else
:
url
=
None
for
t
in
response
.
json
()[
"results"
]:
if
t
[
"timestamp"
]
<
since
:
url
=
None
break
yield
t
def
get_translations_stats
(
translations
):
stats
=
{
"total"
:
0
,
"translators"
:
{}}
for
translation
in
translations
:
if
not
translation
[
"author"
]:
continue
print
(
"translation"
,
translation
[
"action_name"
])
continue
stats
[
"total"
]
+=
1
try
:
stats
[
"translators"
][
translation
[
"author"
]]
+=
1
except
KeyError
:
stats
[
"translators"
][
translation
[
"author"
]]
=
1
return
stats
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"ref_name"
)
parser
.
add_argument
(
"last_tag"
)
args
=
parser
.
parse_args
()
since
=
get_tag_date
(
args
.
last_tag
)
commits
=
get_commits
(
args
.
ref_name
,
since
)
commits_stats
=
get_commit_stats
(
commits
)
commiter_names
=
commits_stats
[
"commiters"
].
keys
()
print
(
"Commiters:"
)
for
commiter
in
sorted
(
commits_stats
[
"commiters"
].
keys
(),
key
=
lambda
v
:
v
.
upper
()):
print
(
commiter
)
translations
=
get_translations
(
since
)
translations_stats
=
get_translations_stats
(
translations
)
translators_ids
=
sorted
(
translations_stats
[
"translators"
].
keys
())
# There is no way to query user/author info via weblate API and we need the names…
print
(
"Execute the following SQL query on the weblate server to get the translators names:"
)
print
(
"$ weblate dbshell"
)
print
(
"SELECT full_name FROM weblate_auth_user WHERE id in ({});"
.
format
(
", "
.
join
([
str
(
i
)
for
i
in
translators_ids
])
)
)
if
__name__
==
"__main__"
:
main
()
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