From 5cdaa06221f73fcb9476c30f52e3210f1e3f65b7 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 28 Oct 2019 08:47:14 -0700 Subject: [PATCH] bin/post_version.py: Make the git commit as well. Reviewed-by: Eric Engestrom Reviewed-by: Juan A. Suarez Part-of: --- bin/post_version.py | 8 ++++++++ bin/post_version_test.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/bin/post_version.py b/bin/post_version.py index 3fbb5e2107c..5cf5f48615e 100755 --- a/bin/post_version.py +++ b/bin/post_version.py @@ -25,6 +25,8 @@ import argparse import calendar import datetime import pathlib +import subprocess + from lxml import ( etree, html, @@ -84,6 +86,7 @@ def update_index(is_point: bool, version: str, previous_version: str) -> None: root.insert(index, header) tree.write(p.as_posix(), method='html', pretty_print=True) + subprocess.run(['git', 'add', p]) def update_release_notes(previous_version: str) -> None: @@ -99,6 +102,7 @@ def update_release_notes(previous_version: str) -> None: ul.insert(0, li) tree.write(p.as_posix(), method='html', pretty_print=True) + subprocess.run(['git', 'add', p]) def update_calendar(previous_version: str) -> None: @@ -132,6 +136,7 @@ def update_calendar(previous_version: str) -> None: new.insert(0, td) tree.write(p.as_posix(), method='html', pretty_print=True) + subprocess.run(['git', 'add', p]) def main() -> None: @@ -145,6 +150,9 @@ def main() -> None: update_index(is_point, args.version, previous_version) update_release_notes(previous_version) update_calendar(previous_version) + subprocess.run(['git', 'commit', '-m', + 'docs: update calendar, add news item, and link releases ' + f'notes for {previous_version}']) if __name__ == "__main__": diff --git a/bin/post_version_test.py b/bin/post_version_test.py index 11b28061e57..d0794a609f4 100644 --- a/bin/post_version_test.py +++ b/bin/post_version_test.py @@ -27,6 +27,8 @@ import pytest from . import post_version +# Mock out subprocess.run to avoid having git commits +@mock.patch('bin.post_version.subprocess.run', mock.Mock()) class TestUpdateCalendar: HEAD = textwrap.dedent("""\ -- 2.30.2