Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

bin: make update-authors.py add multiple contributors in a single commit

Nick Craig-Woode7bc3b248335
diff --git a/bin/update-authors.py b/bin/update-authors.py
index d63ea6016..0c990e205 100755
--- a/bin/update-authors.py
+++ b/bin/update-authors.py
@@ -17,15 +17,28 @@ def load(filename):
authors = fd.read()
return set(re.findall(r"<(.*?)>", authors))
-def add_email(name, email):
+def add_email(added, name, email):
"""
- adds the email passed in to the end of authors.md
+ adds the email passed in to the end of authors.md and records it in added
"""
print("Adding %s <%s>" % (name, email))
with open(AUTHORS, "a+") as fd:
print("- %s <%s>" % (name, email), file=fd)
- subprocess.check_call(["git", "commit", "-m", "Add %s to contributors" % name, AUTHORS])
-
+ added.append((name, email))
+
+def commit(added):
+ """
+ commits authors.md with a message describing the names in added
+ """
+ if not added:
+ return
+ if len(added) == 1:
+ message = "Add %s to contributors" % added[0][0]
+ else:
+ message = "Add %d new contributors\n\n" % len(added)
+ message += "".join("- %s\n" % name for name, _ in added)
+ subprocess.check_call(["git", "commit", "-m", message, AUTHORS])
+
def main():
# Add emails from authors
out = subprocess.check_output(["git", "log", '--reverse', '--format=%an|%ae', "master"])
@@ -34,6 +47,7 @@ def main():
ignored = load(IGNORE)
previous = load(AUTHORS)
previous.update(ignored)
+ added = []
for line in out.split("\n"):
line = line.strip()
if line == "":
@@ -42,7 +56,7 @@ def main():
if email in previous:
continue
previous.add(email)
- add_email(name, email)
+ add_email(added, name, email)
# Add emails from Co-authored-by: lines
out = subprocess.check_output(["git", "log", '-i', '--grep', 'Co-authored-by:', "master"])
@@ -60,7 +74,9 @@ def main():
if email in previous:
continue
previous.add(email)
- add_email(name, email)
+ add_email(added, name, email)
+
+ commit(added)
if __name__ == "__main__":
main()