From e1d3132ace342716c20f32737a514abaa0132550 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 4 Apr 2021 15:05:00 +0300 Subject: feat: commit changes made by Bumper The git tag then points at that commit. --- subplot/bumper.py | 19 ++++++++++++++----- subplot/bumper.yaml | 7 +++++-- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'subplot') diff --git a/subplot/bumper.py b/subplot/bumper.py index 329173c..e340927 100644 --- a/subplot/bumper.py +++ b/subplot/bumper.py @@ -71,17 +71,26 @@ def only_these_files_exist_in(ctx, filenames=None, dirname=None): assert_eq(expect, actual) -def git_tag_points_at(ctx, dirname=None, tag=None, varname=None): +def git_tag_exists(ctx, dirname=None, tag=None): runcmd_run = globals()["runcmd_run"] runcmd_get_stdout = globals()["runcmd_get_stdout"] runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + logging.debug(f"expecting tag {tag} to exist") runcmd_run(ctx, ["git", "show", "--raw", tag], cwd=dirname) runcmd_exit_code_is_zero(ctx) - output = runcmd_get_stdout(ctx) - commit = ctx[varname] - logging.debug(f"expecting tag {tag} to point at {commit}") logging.debug(f"tag: {output!r}") assert output.startswith(f"tag {tag}\n") - assert f"\ncommit {commit}" in output + + +def git_working_tree_is_clean(ctx, dirname=None): + runcmd_run = globals()["runcmd_run"] + runcmd_get_stdout = globals()["runcmd_get_stdout"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + assert_eq = globals()["assert_eq"] + + runcmd_run(ctx, ["git", "status", "--porcelain"], cwd=dirname) + runcmd_exit_code_is_zero(ctx) + output = runcmd_get_stdout(ctx) + assert_eq(output, "") diff --git a/subplot/bumper.yaml b/subplot/bumper.yaml index d1ee4f0..50cf83c 100644 --- a/subplot/bumper.yaml +++ b/subplot/bumper.yaml @@ -16,5 +16,8 @@ - then: "only files {filenames:text} exist in {dirname}" function: only_these_files_exist_in -- then: "in {dirname}, git tag {tag} is a signed tag pointing at <{varname}>" - function: git_tag_points_at +- then: "in {dirname}, git tag {tag} is a signed tag" + function: git_tag_exists + +- then: "all changes in {dirname} are committed" + function: git_working_tree_is_clean -- cgit v1.2.1