mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-15 18:08:45 -07:00
Compact and slightly reorder author list
More prominent positions are given to authors with more commits, in steps of magnitude. Authors with 100-999 commits are listed before authors with 10-99 commits. Yes, this puts me at the head of the list and is a slight ego trip, but I still think it's the right thing to do.
This commit is contained in:
parent
ba5231dc89
commit
8d53175c20
@ -8,96 +8,10 @@
|
||||
</h1>
|
||||
<hr/>
|
||||
|
||||
<p translate>Copyright © 2015 the following Contributors:</p>
|
||||
<p translate>Copyright © 2014-2016 the following Contributors:</p>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="list-unstyled three-columns" id="contributor-list">
|
||||
<li class="auto-generated">Aaron Bieber</li>
|
||||
<li class="auto-generated">Adam Piggott</li>
|
||||
<li class="auto-generated">Alessandro G.</li>
|
||||
<li class="auto-generated">Alexander Graf</li>
|
||||
<li class="auto-generated">Anderson Mesquita</li>
|
||||
<li class="auto-generated">Andrew Dunham</li>
|
||||
<li class="auto-generated">Antony Male</li>
|
||||
<li class="auto-generated">Arthur Axel fREW Schmidt</li>
|
||||
<li class="auto-generated">Audrius Butkevicius</li>
|
||||
<li class="auto-generated">Bart De Vries</li>
|
||||
<li class="auto-generated">Ben Curthoys</li>
|
||||
<li class="auto-generated">Ben Schulz</li>
|
||||
<li class="auto-generated">Ben Sidhom</li>
|
||||
<li class="auto-generated">Benny Ng</li>
|
||||
<li class="auto-generated">Brandon Philips</li>
|
||||
<li class="auto-generated">Brendan Long</li>
|
||||
<li class="auto-generated">Brian R. Becker</li>
|
||||
<li class="auto-generated">Caleb Callaway</li>
|
||||
<li class="auto-generated">Carsten Hagemann</li>
|
||||
<li class="auto-generated">Cathryne Linenweaver</li>
|
||||
<li class="auto-generated">Chris Howie</li>
|
||||
<li class="auto-generated">Chris Joel</li>
|
||||
<li class="auto-generated">Colin Kennedy</li>
|
||||
<li class="auto-generated">Daniel Bergmann</li>
|
||||
<li class="auto-generated">Daniel Harte</li>
|
||||
<li class="auto-generated">Daniel Martí</li>
|
||||
<li class="auto-generated">Denis A.</li>
|
||||
<li class="auto-generated">Dennis Wilson</li>
|
||||
<li class="auto-generated">Dominik Heidler</li>
|
||||
<li class="auto-generated">Elias Jarlebring</li>
|
||||
<li class="auto-generated">Emil Hessman</li>
|
||||
<li class="auto-generated">Erik Meitner</li>
|
||||
<li class="auto-generated">Federico Castagnini</li>
|
||||
<li class="auto-generated">Felix Ableitner</li>
|
||||
<li class="auto-generated">Felix Unterpaintner</li>
|
||||
<li class="auto-generated">Francois-Xavier Gsell</li>
|
||||
<li class="auto-generated">Frank Isemann</li>
|
||||
<li class="auto-generated">Gilli Sigurdsson</li>
|
||||
<li class="auto-generated">Jaakko Hannikainen</li>
|
||||
<li class="auto-generated">Jacek Szafarkiewicz</li>
|
||||
<li class="auto-generated">Jake Peterson</li>
|
||||
<li class="auto-generated">Jakob Borg</li>
|
||||
<li class="auto-generated">James Patterson</li>
|
||||
<li class="auto-generated">Jaroslav Malec</li>
|
||||
<li class="auto-generated">Jens Diemer</li>
|
||||
<li class="auto-generated">Jochen Voss</li>
|
||||
<li class="auto-generated">Johan Vromans</li>
|
||||
<li class="auto-generated">Karol Różycki</li>
|
||||
<li class="auto-generated">Ken'ichi Kamada</li>
|
||||
<li class="auto-generated">Kevin Allen</li>
|
||||
<li class="auto-generated">Lars K.W. Gohlke</li>
|
||||
<li class="auto-generated">Laurent Etiemble</li>
|
||||
<li class="auto-generated">Lode Hoste</li>
|
||||
<li class="auto-generated">Lord Landon Agahnim</li>
|
||||
<li class="auto-generated">Marc Laporte</li>
|
||||
<li class="auto-generated">Marc Pujol</li>
|
||||
<li class="auto-generated">Marcin Dziadus</li>
|
||||
<li class="auto-generated">Mateusz Naściszewski</li>
|
||||
<li class="auto-generated">Matt Burke</li>
|
||||
<li class="auto-generated">Max Schulze</li>
|
||||
<li class="auto-generated">Michael Jephcote</li>
|
||||
<li class="auto-generated">Michael Ploujnikov</li>
|
||||
<li class="auto-generated">Michael Tilli</li>
|
||||
<li class="auto-generated">Nate Morrison</li>
|
||||
<li class="auto-generated">Pascal Jungblut</li>
|
||||
<li class="auto-generated">Peter Hoeg</li>
|
||||
<li class="auto-generated">Philippe Schommers</li>
|
||||
<li class="auto-generated">Phill Luby</li>
|
||||
<li class="auto-generated">Piotr Bejda</li>
|
||||
<li class="auto-generated">Ryan Sullivan</li>
|
||||
<li class="auto-generated">Scott Klupfel</li>
|
||||
<li class="auto-generated">Sergey Mishin</li>
|
||||
<li class="auto-generated">Stefan Kuntz</li>
|
||||
<li class="auto-generated">Stefan Tatschner</li>
|
||||
<li class="auto-generated">Tim Abell</li>
|
||||
<li class="auto-generated">Tobias Nygren</li>
|
||||
<li class="auto-generated">Tomas Cerveny</li>
|
||||
<li class="auto-generated">Tully Robinson</li>
|
||||
<li class="auto-generated">Tyler Brazier</li>
|
||||
<li class="auto-generated">Veeti Paananen</li>
|
||||
<li class="auto-generated">Victor Buinsky</li>
|
||||
<li class="auto-generated">Vil Brekin</li>
|
||||
<li class="auto-generated">William A. Kennington III</li>
|
||||
<li class="auto-generated">Wulf Weich</li>
|
||||
<li class="auto-generated">Yannic A.</li>
|
||||
</ul>
|
||||
<div class="col-md-12" id="contributor-list">
|
||||
Jakob Borg, Audrius Butkevicius, Alexander Graf, Anderson Mesquita, Ben Schulz, Caleb Callaway, Lode Hoste, Philippe Schommers, Ryan Sullivan, Sergey Mishin, Stefan Tatschner, Aaron Bieber, Adam Piggott, Alessandro G., Andrew Dunham, Antony Male, Arthur Axel fREW Schmidt, Bart De Vries, Ben Curthoys, Ben Sidhom, Benny Ng, Brandon Philips, Brendan Long, Brian R. Becker, Carsten Hagemann, Cathryne Linenweaver, Chris Howie, Chris Joel, Colin Kennedy, Daniel Bergmann, Daniel Harte, Daniel Martí, Denis A., Dennis Wilson, Dominik Heidler, Elias Jarlebring, Emil Hessman, Erik Meitner, Federico Castagnini, Felix Ableitner, Felix Unterpaintner, Francois-Xavier Gsell, Frank Isemann, Gilli Sigurdsson, Jaakko Hannikainen, Jacek Szafarkiewicz, Jake Peterson, James Patterson, Jaroslav Malec, Jens Diemer, Jochen Voss, Johan Vromans, Karol Różycki, Ken'ichi Kamada, Kevin Allen, Lars K.W. Gohlke, Laurent Etiemble, Lord Landon Agahnim, Marc Laporte, Marc Pujol, Marcin Dziadus, Mateusz Naściszewski, Matt Burke, Max Schulze, Michael Jephcote, Michael Ploujnikov, Michael Tilli, Nate Morrison, Pascal Jungblut, Peter Hoeg, Phill Luby, Piotr Bejda, Scott Klupfel, Stefan Kuntz, Tim Abell, Tobias Nygren, Tomas Cerveny, Tully Robinson, Tyler Brazier, Veeti Paananen, Victor Buinsky, Vil Brekin, William A. Kennington III, Wulf Weich, Yannic A.
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
File diff suppressed because one or more lines are too long
@ -12,9 +12,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
@ -22,28 +25,65 @@ import (
|
||||
|
||||
const htmlFile = "gui/default/syncthing/core/aboutModalView.html"
|
||||
|
||||
func main() {
|
||||
bs := readAll("AUTHORS")
|
||||
lines := strings.Split(string(bs), "\n")
|
||||
nameRe := regexp.MustCompile(`(.+?)\s+<`)
|
||||
authors := make([]string, 0, len(lines))
|
||||
for _, line := range lines {
|
||||
if m := nameRe.FindStringSubmatch(line); len(m) == 2 {
|
||||
authors = append(authors, " <li class=\"auto-generated\">"+m[1]+"</li>")
|
||||
}
|
||||
}
|
||||
sort.Strings(authors)
|
||||
replacement := strings.Join(authors, "\n")
|
||||
type author struct {
|
||||
name string
|
||||
emails []string
|
||||
commits int
|
||||
log10commits int
|
||||
}
|
||||
|
||||
authorsRe := regexp.MustCompile(`(?s)id="contributor-list">.*?</ul>`)
|
||||
bs = readAll(htmlFile)
|
||||
bs = authorsRe.ReplaceAll(bs, []byte("id=\"contributor-list\">\n"+replacement+"\n </ul>"))
|
||||
func main() {
|
||||
authors := getAuthors()
|
||||
getContributions(authors)
|
||||
sort.Sort(byContributions(authors))
|
||||
|
||||
var lines []string
|
||||
for _, author := range authors {
|
||||
lines = append(lines, author.name)
|
||||
}
|
||||
replacement := strings.Join(lines, ", ")
|
||||
|
||||
authorsRe := regexp.MustCompile(`(?s)id="contributor-list">.*?</div>`)
|
||||
bs := readAll(htmlFile)
|
||||
bs = authorsRe.ReplaceAll(bs, []byte("id=\"contributor-list\">\n"+replacement+"\n </div>"))
|
||||
|
||||
if err := ioutil.WriteFile(htmlFile, bs, 0644); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func getAuthors() []author {
|
||||
bs := readAll("AUTHORS")
|
||||
lines := strings.Split(string(bs), "\n")
|
||||
var authors []author
|
||||
nameRe := regexp.MustCompile(`(.+?)\s+<`)
|
||||
authorRe := regexp.MustCompile(`<([^>]+)>`)
|
||||
for _, line := range lines {
|
||||
m := nameRe.FindStringSubmatch(line)
|
||||
if len(m) < 2 {
|
||||
continue
|
||||
}
|
||||
name := m[1]
|
||||
|
||||
ms := authorRe.FindAllStringSubmatch(line, -1)
|
||||
if len(ms) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
var emails []string
|
||||
for i := range ms {
|
||||
emails = append(emails, ms[i][1])
|
||||
}
|
||||
|
||||
a := author{
|
||||
name: name,
|
||||
emails: emails,
|
||||
}
|
||||
authors = append(authors, a)
|
||||
}
|
||||
return authors
|
||||
}
|
||||
|
||||
func readAll(path string) []byte {
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
@ -58,3 +98,46 @@ func readAll(path string) []byte {
|
||||
|
||||
return bs
|
||||
}
|
||||
|
||||
// Add number of commits per author to the author list.
|
||||
func getContributions(authors []author) {
|
||||
buf := new(bytes.Buffer)
|
||||
cmd := exec.Command("git", "log", "--pretty=format:%ae")
|
||||
cmd.Stdout = buf
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
next:
|
||||
for _, line := range strings.Split(buf.String(), "\n") {
|
||||
for i := range authors {
|
||||
for _, email := range authors[i].emails {
|
||||
if email == line {
|
||||
authors[i].commits++
|
||||
continue next
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for i := range authors {
|
||||
authors[i].log10commits = int(math.Log10(float64(authors[i].commits + 1)))
|
||||
}
|
||||
}
|
||||
|
||||
type byContributions []author
|
||||
|
||||
func (l byContributions) Len() int { return len(l) }
|
||||
|
||||
// Sort first by log10(commits), then by name. This means that we first get
|
||||
// an alphabetic list of people with >= 1000 commits, then a list of people
|
||||
// with >= 100 commits, and so on.
|
||||
func (l byContributions) Less(a, b int) bool {
|
||||
if l[a].log10commits != l[b].log10commits {
|
||||
return l[a].log10commits > l[b].log10commits
|
||||
}
|
||||
return l[a].name < l[b].name
|
||||
}
|
||||
|
||||
func (l byContributions) Swap(a, b int) { l[a], l[b] = l[b], l[a] }
|
||||
|
Loading…
Reference in New Issue
Block a user