Mercurial > repos > public > sbplib_julia
diff benchmark/benchmark_utils.jl @ 1310:8754d0f06ce4 tooling/benchmarks
Add hg_strip()
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 26 Apr 2023 13:38:34 +0200 |
parents | 7fc84c2f9e1d |
children | 5eb1d0ae0ac1 |
line wrap: on
line diff
--- a/benchmark/benchmark_utils.jl Wed Apr 26 13:37:58 2023 +0200 +++ b/benchmark/benchmark_utils.jl Wed Apr 26 13:38:34 2023 +0200 @@ -151,6 +151,23 @@ return only(match(r"committed changeset \d+:([0-9a-z]+)", out)) end +""" + hg_strip(rev; keep=false) + +Strips the given commit from the repo. If `keep` is true, the changes of the +commit are kept in the working directory. +""" +function hg_strip(rev; keep=false) + if keep + cmd = Cmd(`hg --config extensions.strip= strip --keep -r $rev`, dir=sbplib_root) + else + cmd = Cmd(`hg --config extensions.strip= strip -r $rev`, dir=sbplib_root) + end + + run(addenv(cmd, "HGPLAIN"=>"")) + + return nothing +end function hg_is_dirty() cmd = Cmd(`hg identify --id`, dir=sbplib_root) out = readchomp(addenv(cmd, "HGPLAIN"=>""))