summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-04 15:05:00 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-04 15:49:23 +0300
commite1d3132ace342716c20f32737a514abaa0132550 (patch)
tree37156ee9184507d419a65572ee1c59d2666d0c6a /subplot
parentaa8675d968aa070a976557e1bc54919a2ac9cde4 (diff)
downloadbumper-rs-e1d3132ace342716c20f32737a514abaa0132550.tar.gz
feat: commit changes made by Bumper
The git tag then points at that commit.
Diffstat (limited to 'subplot')
-rw-r--r--subplot/bumper.py19
-rw-r--r--subplot/bumper.yaml7
2 files changed, 19 insertions, 7 deletions
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