comparison 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
comparison
equal deleted inserted replaced
1302:68dd0c9f5cac 1303:2d34290fdc58
128 function hg_update(rev) 128 function hg_update(rev)
129 cmd = Cmd(`hg update --check -r $rev`, dir=sbplib_root) 129 cmd = Cmd(`hg update --check -r $rev`, dir=sbplib_root)
130 run(addenv(cmd, "HGPLAIN"=>"")) 130 run(addenv(cmd, "HGPLAIN"=>""))
131 end 131 end
132 132
133 function hg_commit(msg)
134 cmd = Cmd(`hg commit --verbose --message $msg`, dir=sbplib_root)
135 out = readchomp(addenv(cmd, "HGPLAIN"=>""))
136
137 return only(match(r"committed changeset \d+:([0-9a-z]+)", out))
138 end
139
140 function hg_is_dirty()
141 cmd = Cmd(`hg identify --id`, dir=sbplib_root)
142 out = readchomp(addenv(cmd, "HGPLAIN"=>""))
143
144 return endswith(out, "+")
145 end
146
147
133 148
134 # From Pluto.jl/src/webserver/WebServer.jl (2023-01-24) 149 # From Pluto.jl/src/webserver/WebServer.jl (2023-01-24)
135 function open_in_default_browser(url::AbstractString)::Bool 150 function open_in_default_browser(url::AbstractString)::Bool
136 try 151 try
137 if Sys.isapple() 152 if Sys.isapple()