Skip to content

Commit

Permalink
Create a script to automate the authors list
Browse files Browse the repository at this point in the history
1. It was always out of date
2. I prefer sorting it by number of commits :)
  • Loading branch information
hugomg committed Jun 12, 2023
1 parent 26c0e92 commit ff36fe2
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 12 deletions.
12 changes: 0 additions & 12 deletions AUTHORS

This file was deleted.

19 changes: 19 additions & 0 deletions AUTHORS.md
@@ -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
103 changes: 103 additions & 0 deletions misc/compute-authors.lua
@@ -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

0 comments on commit ff36fe2

Please sign in to comment.