Add option to commit right away to accept.py

This commit is contained in:
Jonas Wielicki 2018-01-25 09:02:56 +01:00
parent 3c5caacd85
commit 0202f9166b
1 changed files with 28 additions and 0 deletions

View File

@ -2,6 +2,7 @@
import pathlib
import re
import shutil
import subprocess
import sys
import xml.etree.ElementTree as etree
@ -121,6 +122,13 @@ def main():
help="Force acceptance even if suspicious.",
)
parser.add_argument(
"-c", "--commit",
default=False,
action="store_true",
help="Make a git commit",
)
parser.add_argument(
"item",
help="Inbox name"
@ -199,6 +207,26 @@ def main():
xepinfo["approver"],
args.votedate.date())
if args.commit:
subprocess.check_call([
"git", "reset", "HEAD", ".",
])
subprocess.check_call([
"git", "add", new_filename.parts[-1],
])
if args.ask:
flags = ["-ve"]
else:
flags = []
subprocess.check_call(
[
"git", "commit", "-m", "Accept {} as XEP-{:04}".format(
inbox_path,
new_number,
)
] + flags
)
if __name__ == "__main__":
main()