-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a script to automate the authors list
1. It was always out of date 2. I prefer sorting it by number of commits :)
- Loading branch information
Showing
3 changed files
with
122 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Pallene Authors | ||
--------------- | ||
|
||
Here we thank the many people who have contributed code to this project. | ||
This list was last updated in 2023-06-11, using compute-authors.lua. | ||
|
||
Hugo Musso Gualandi | ||
Gabriel de Quadros Ligneul | ||
Srijan Paul | ||
Samuel Rowe | ||
Fabio Mascarenhas | ||
Hisham Muhammad | ||
Matheus Ambrozio | ||
Sérgio Queiroz | ||
Andre Murbach Maidl | ||
PJ Pollina | ||
Ahmed Karaman | ||
Eric Wing | ||
Björn Buckwalter |
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,103 @@ | ||
#!/usr/bin/lua | ||
|
||
-- | ||
-- Command line parsing | ||
-- | ||
|
||
local argparse = require "argparse" | ||
local p = argparse(arg[0], [[ | ||
Compute the author list from the Git shortlog, | ||
taking care to deduplicate authors with more than one e-mail]]) | ||
|
||
p:option("--at-least", "Only list authors with this many commits (def. 5)") | ||
:default(5) | ||
:convert(tonumber) | ||
:argname("N") | ||
|
||
p:flag("--show-count", "Also show the commit counts") | ||
|
||
args = p:parse() | ||
|
||
-- | ||
-- Deduplication | ||
-- | ||
|
||
-- Canonical => Aliases | ||
local aliases = { | ||
["Hugo Musso Gualandi"] = { | ||
"Hugo Gualandi", | ||
"hugomg"}, | ||
|
||
["Sérgio Queiroz"] = { | ||
"Sergio Queiroz" }, | ||
|
||
["Srijan Paul"] = { | ||
"srijan-paul", | ||
"injuly", | ||
"inJuly", | ||
"inJuly0"} | ||
} | ||
|
||
-- Alias => Canonical | ||
local dedup = {} | ||
for canonical, xs in pairs(aliases) do | ||
for _, x in ipairs(xs) do | ||
dedup[x] = canonical | ||
end | ||
end | ||
|
||
-- | ||
-- Compute the number of contributions per author | ||
-- | ||
|
||
local gitlog = assert(io.popen("git shortlog --summary --no-merges")) | ||
|
||
local names = {} | ||
local total = {} | ||
for line in gitlog:lines() do | ||
local count, name = string.match(line, "%s*(%d+)%s+(.*)") | ||
count = tonumber(count) | ||
name = dedup[name] or name | ||
|
||
if not total[name] then | ||
table.insert(names, name) | ||
total[name] = 0 | ||
end | ||
|
||
total[name] = total[name] + count | ||
end | ||
|
||
table.sort(names, function(a, b) | ||
return total[b] < total[a] | ||
end) | ||
|
||
gitlog:close() | ||
|
||
-- | ||
-- Print the results | ||
-- | ||
|
||
local date | ||
do | ||
local f = assert(io.popen("date --iso-8601")) | ||
date = f:read("l") | ||
f:close() | ||
end | ||
|
||
io.write([[ | ||
Pallene Authors | ||
--------------- | ||
Here we thank the many people who have contributed code to this project. | ||
This list was last updated in ]], date, [[, using compute-authors.lua. | ||
]]) | ||
for _, name in ipairs(names) do | ||
if total[name] >= args.at_least then | ||
if args.show_count then | ||
print(total[name], name) | ||
else | ||
print(name) | ||
end | ||
end | ||
end |