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:
parent
c3eba8e927
commit
02b9c22b1d
@ -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,14 +76,15 @@ def defer_xep(number, last_version, initials):
|
|||||||
del version[2:]
|
del version[2:]
|
||||||
version.append("0")
|
version.append("0")
|
||||||
|
|
||||||
xep_text = (
|
if insert_revision:
|
||||||
xep_text[:revision_match.start()] +
|
xep_text = (
|
||||||
REVISION_TEMPLATE.format(
|
xep_text[:revision_match.start()] +
|
||||||
now=datetime.utcnow(),
|
REVISION_TEMPLATE.format(
|
||||||
version=".".join(version),
|
now=datetime.utcnow(),
|
||||||
initials=initials,
|
version=".".join(version),
|
||||||
) + xep_text[revision_match.start():]
|
initials=initials,
|
||||||
)
|
) + xep_text[revision_match.start():]
|
||||||
|
)
|
||||||
|
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
f.write(xep_text)
|
f.write(xep_text)
|
||||||
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user