1
0
mirror of https://github.com/moparisthebest/xeps synced 2025-02-16 23:30:21 -05:00

Add flag to suppress insertion of revision block for deferrals

This commit is contained in:
Jonas Schäfer 2020-01-02 17:59:03 +01:00
parent c3eba8e927
commit 02b9c22b1d

View File

@ -56,7 +56,7 @@ def stash_guard():
subprocess.check_call(["git", "stash", "pop"]) subprocess.check_call(["git", "stash", "pop"])
def defer_xep(number, last_version, initials): def defer_xep(number, last_version, initials, insert_revision):
filename = "xep-{:04d}.xml".format(number) filename = "xep-{:04d}.xml".format(number)
with open(filename, "r") as f: with open(filename, "r") as f:
xep_text = f.read() xep_text = f.read()
@ -76,6 +76,7 @@ def defer_xep(number, last_version, initials):
del version[2:] del version[2:]
version.append("0") version.append("0")
if insert_revision:
xep_text = ( xep_text = (
xep_text[:revision_match.start()] + xep_text[:revision_match.start()] +
REVISION_TEMPLATE.format( REVISION_TEMPLATE.format(
@ -119,6 +120,14 @@ def main():
"INITIALS in the remarks." "INITIALS in the remarks."
) )
parser.add_argument(
"--no-revision",
dest="insert_revision",
action="store_false",
default=True,
help="Do not create a revision block",
)
parser.add_argument( parser.add_argument(
"-c", "--commit", "-c", "--commit",
default=False, default=False,
@ -145,19 +154,23 @@ def main():
if args.modify: if args.modify:
defer_xep(deferred_info["number"], defer_xep(deferred_info["number"],
deferred_info["last_revision"]["version"], deferred_info["last_revision"]["version"],
args.modify) args.modify,
args.insert_revision)
if args.commit: if args.commit:
subprocess.check_call([ subprocess.check_call([
"git", "add", "xep-{:04d}.xml".format( "git", "add", "xep-{:04d}.xml".format(
deferred_info["number"], deferred_info["number"],
), ),
]) ])
subprocess.check_call([ commit_argv = [
"git", "commit", "-vem", "git", "commit", "-vm",
"XEP-{:04d}: deferred due to lack of activity".format( "XEP-{:04d}: deferred due to lack of activity".format(
deferred_info["number"], deferred_info["number"],
), )
]) ]
if args.insert_revision:
commit_argv.append("-e")
subprocess.check_call(commit_argv)
if args.verbose: if args.verbose:
print( print(