Mercurial > repos > public > sbplib_julia
diff benchmark/benchmark_utils.jl @ 1303:2d34290fdc58 tooling/benchmarks
Add functions for hg commit and checking if the repo is clean
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 23 Mar 2023 08:55:31 +0100 |
parents | 68dd0c9f5cac |
children | 7894d29ea8fa |
line wrap: on
line diff
--- a/benchmark/benchmark_utils.jl Thu Mar 23 08:40:58 2023 +0100 +++ b/benchmark/benchmark_utils.jl Thu Mar 23 08:55:31 2023 +0100 @@ -130,6 +130,21 @@ run(addenv(cmd, "HGPLAIN"=>"")) end +function hg_commit(msg) + cmd = Cmd(`hg commit --verbose --message $msg`, dir=sbplib_root) + out = readchomp(addenv(cmd, "HGPLAIN"=>"")) + + return only(match(r"committed changeset \d+:([0-9a-z]+)", out)) +end + +function hg_is_dirty() + cmd = Cmd(`hg identify --id`, dir=sbplib_root) + out = readchomp(addenv(cmd, "HGPLAIN"=>"")) + + return endswith(out, "+") +end + + # From Pluto.jl/src/webserver/WebServer.jl (2023-01-24) function open_in_default_browser(url::AbstractString)::Bool