-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool for creating credits file from git history.
- Loading branch information
1 parent
c3849a0
commit f27e9ee
Showing
8 changed files
with
149 additions
and
0 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 |
---|---|---|
|
@@ -54,6 +54,7 @@ LEVELS2.str | |
pxomain.ogf | ||
pxogame.ogf | ||
gamecredits.txt | ||
oscredits.txt | ||
loki.ogf | ||
aigame2.so | ||
AIGame3.so | ||
|
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
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 |
---|---|---|
|
@@ -54,6 +54,7 @@ LEVELS2.str | |
pxomain.ogf | ||
pxogame.ogf | ||
gamecredits.txt | ||
oscredits.txt | ||
loki.ogf | ||
aigame2.dll | ||
AIGame3.dll | ||
|
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,48 @@ | ||
; This file was autogenerated by git-contributors.py | ||
|
||
|
||
*320 100 320 100 8 | ||
!OPEN SOURCE CONTRIBUTORS | ||
|
||
https://github.com/DescentDevelopers/Descent3 | ||
|
||
Andrew Grigorev | ||
Azamat H. Hackimov | ||
Bernhard M. Wiedemann | ||
Bryan Perris | ||
C.W. "Madd The Sane" Betts | ||
Chris Sarbora | ||
Christian Baumann | ||
Dan Raviv | ||
Daniel Gibson | ||
Edu Garcia | ||
Eric Slutz | ||
GravisZro | ||
InsanityBringer | ||
Jacob Coby | ||
Jan Engelhardt | ||
Jason Yundt | ||
Jeff Slutter | ||
JeodC | ||
Kevin Bentley | ||
Kevin Caccamo | ||
Kreeblah | ||
Louis "Lgt2x" Gombert | ||
Martin | ||
Matt Stephenson | ||
Oskar Strengbohm | ||
Peter Simard | ||
Phil Ashby | ||
Ryan C. Gordon | ||
Sebastian Holtermann | ||
Taylor Richards | ||
Thomas Otto | ||
Thomas Ross | ||
bperris | ||
scivision | ||
sirken | ||
thfrwn | ||
vlohacks | ||
ziplantil | ||
|
||
END |
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,24 @@ | ||
# git-contributors.py | ||
|
||
**git-contributors.py** - script to generate contributors list from git history. | ||
|
||
## Requirements | ||
|
||
* Recent python (3.12+) | ||
* GitPython package (https://pypi.org/project/GitPython/) | ||
|
||
## Usage | ||
|
||
Just run `git-contributors.py`, review and commit `scripts/data/fullhog/oscredits.txt`. | ||
You're now awesome. | ||
|
||
**Remember regenerate file before releasing new version!** | ||
|
||
## Customization | ||
|
||
Tool provides two ways of customization: | ||
|
||
* Exclude particular name from list of contributors (file `no-add.txt`, | ||
one name per line, comments begins with `#`). | ||
* Replace name in list of contributors with other one (file `map-names`, | ||
one entry per line in format `git_name:replace_name`, comments begins with `#`). |
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,69 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Descent 3 | ||
# Copyright (C) 2024 Descent Developers | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from git import Repo | ||
import re | ||
|
||
|
||
def strip_comments(code): | ||
code = str(code) | ||
return re.sub(r'(#.*)?\n?', '', code) | ||
|
||
|
||
def main(): | ||
noadds = list() | ||
name_maps = dict() | ||
with open("no-add.txt") as noadd_file: | ||
for line in noadd_file: | ||
name = strip_comments(line) | ||
noadds.append(name.strip()) | ||
with open("map-names.txt") as map_file: | ||
for line in map_file: | ||
(git_name, replace_name) = strip_comments(line.strip()).split(":") | ||
name_maps.update({git_name: replace_name}) | ||
|
||
repo = Repo("../..") | ||
commits = list(repo.iter_commits("main")) | ||
authors = set() | ||
|
||
for commit in commits: | ||
if commit.author.name not in noadds: | ||
if commit.author.name in name_maps.keys(): | ||
authors.add(name_maps[commit.author.name]) | ||
else: | ||
authors.add(commit.author.name) | ||
|
||
with open("../../scripts/data/fullhog/oscredits.txt", "w") as result_file: | ||
result_file.write("; This file was autogenerated by git-contributors.py\n") | ||
result_file.write("\n") | ||
result_file.write("\n") | ||
result_file.write("*320 100 320 100 8\n") | ||
result_file.write("!OPEN SOURCE CONTRIBUTORS\n") | ||
result_file.write("\n") | ||
result_file.write("https://github.com/DescentDevelopers/Descent3\n") | ||
result_file.write("\n") | ||
|
||
for author in sorted(authors): | ||
result_file.write(f"{author}\n") | ||
|
||
result_file.write("\n") | ||
result_file.write("END\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,3 @@ | ||
C.W. Betts:C.W. "Madd The Sane" Betts | ||
Louis Gombert:Louis "Lgt2x" Gombert | ||
Thomas Roß:Thomas Ross # No ß in current font |
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,2 @@ | ||
Edu García # Superseded by 'Edu Garcia' | ||
Jeod # Superseded by 'JeodC' |