From 19cb8fcd22e9d2bc240cbd2b23efa2e19cf7ea52 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 5 Apr 2021 11:47:03 +0300 Subject: feat: update Cargo.lock int Rust projects If we update Cargo.toml, but not Cargo.lock, and Cargo.lock is in git, when cargo publish will refuse to publish, because the files are out of sync. --- subplot/bumper.py | 14 ++++++++++++++ subplot/bumper.yaml | 6 ++++++ 2 files changed, 20 insertions(+) (limited to 'subplot') diff --git a/subplot/bumper.py b/subplot/bumper.py index e340927..3edad5e 100644 --- a/subplot/bumper.py +++ b/subplot/bumper.py @@ -94,3 +94,17 @@ def git_working_tree_is_clean(ctx, dirname=None): runcmd_exit_code_is_zero(ctx) output = runcmd_get_stdout(ctx) assert_eq(output, "") + + +def file_is_newer_than_other_file(ctx, file1=None, file2=None): + assert os.path.getmtime(file1) > os.path.getmtime(file2) + + +def file_is_in_git(ctx, filename=None): + runcmd_run = globals()["runcmd_run"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + + dirname = os.path.dirname(filename) or "." + basename = os.path.basename(filename) + runcmd_run(ctx, ["git", "blame", basename], cwd=dirname) + runcmd_exit_code_is_zero(ctx) diff --git a/subplot/bumper.yaml b/subplot/bumper.yaml index 50cf83c..6109c59 100644 --- a/subplot/bumper.yaml +++ b/subplot/bumper.yaml @@ -21,3 +21,9 @@ - then: "all changes in {dirname} are committed" function: git_working_tree_is_clean + +- then: "file {file1} is newer than {file2}" + function: file_is_newer_than_other_file + +- then: "file {filename} is committed to git" + function: file_is_in_git -- cgit v1.2.1