mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Use rust-g for revision info instead of parsing .git
This commit is contained in:
committed by
yogstation13-bot
parent
2ca366b942
commit
b98c3cb199
@@ -3,5 +3,8 @@
|
|||||||
|
|
||||||
#define rustg_dmi_strip_metadata(fname) call(RUST_G, "dmi_strip_metadata")(fname)
|
#define rustg_dmi_strip_metadata(fname) call(RUST_G, "dmi_strip_metadata")(fname)
|
||||||
|
|
||||||
|
#define rustg_git_revparse(rev) call(RUST_G, "rg_git_revparse")(rev)
|
||||||
|
#define rustg_git_commit_date(rev) call(RUST_G, "rg_git_commit_date")(rev)
|
||||||
|
|
||||||
#define rustg_log_write(fname, text) call(RUST_G, "log_write")(fname, text)
|
#define rustg_log_write(fname, text) call(RUST_G, "log_write")(fname, text)
|
||||||
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")()
|
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")()
|
||||||
|
|||||||
@@ -1,44 +1,40 @@
|
|||||||
/datum/getrev
|
/datum/getrev
|
||||||
var/originmastercommit
|
var/commit // git rev-parse HEAD
|
||||||
var/commit
|
|
||||||
var/list/testmerge = list()
|
|
||||||
var/date
|
var/date
|
||||||
|
var/originmastercommit // git rev-parse origin/master
|
||||||
|
var/list/testmerge = list()
|
||||||
|
|
||||||
/datum/getrev/New()
|
/datum/getrev/New()
|
||||||
testmerge = world.TgsTestMerges()
|
testmerge = world.TgsTestMerges()
|
||||||
log_world("Running /tg/ revision:")
|
|
||||||
var/datum/tgs_revision_information/revinfo = world.TgsRevision()
|
var/datum/tgs_revision_information/revinfo = world.TgsRevision()
|
||||||
if(revinfo)
|
if(revinfo)
|
||||||
commit = revinfo.commit
|
commit = revinfo.commit
|
||||||
originmastercommit = revinfo.origin_commit
|
originmastercommit = revinfo.origin_commit
|
||||||
else
|
else
|
||||||
var/list/logs = world.file2list(".git/logs/HEAD")
|
commit = rustg_git_revparse("HEAD")
|
||||||
if(logs.len)
|
if(commit)
|
||||||
logs = splittext(logs[logs.len - 1], " ")
|
date = rustg_git_commit_date(commit)
|
||||||
date = unix2date(text2num(logs[5]))
|
originmastercommit = rustg_git_revparse("origin/master")
|
||||||
commit = logs[2]
|
|
||||||
log_world("[commit]: [date]")
|
|
||||||
else
|
|
||||||
log_world("Unable to read git logs, revision information not available")
|
|
||||||
originmastercommit = commit = "Unknown"
|
|
||||||
date = unix2date(world.timeofday)
|
|
||||||
return
|
|
||||||
logs = world.file2list(".git/logs/refs/remotes/origin/master")
|
|
||||||
if(logs.len)
|
|
||||||
originmastercommit = splittext(logs[logs.len - 1], " ")[2]
|
|
||||||
|
|
||||||
if(testmerge.len)
|
// goes to DD log and config_error.txt
|
||||||
log_world(commit)
|
log_world(get_log_message())
|
||||||
for(var/line in testmerge)
|
|
||||||
if(line)
|
/datum/getrev/proc/get_log_message()
|
||||||
var/datum/tgs_revision_information/test_merge/tm = line
|
var/list/msg = list()
|
||||||
var/tmcommit = tm.commit
|
msg += "Running /tg/ revision: [date]"
|
||||||
log_world("Test merge active of PR #[tm.number] commit [tmcommit]")
|
|
||||||
SSblackbox.record_feedback("nested tally", "testmerged_prs", 1, list("[tm.number]", "[tmcommit]"))
|
|
||||||
if(originmastercommit)
|
if(originmastercommit)
|
||||||
log_world("Based off origin/master commit [originmastercommit]")
|
msg += "origin/master: [originmastercommit]"
|
||||||
else if(originmastercommit)
|
|
||||||
log_world(originmastercommit)
|
for(var/line in testmerge)
|
||||||
|
var/datum/tgs_revision_information/test_merge/tm = line
|
||||||
|
msg += "Test merge active of PR #[tm.number] commit [tm.commit]"
|
||||||
|
|
||||||
|
if(commit && commit != originmastercommit)
|
||||||
|
msg += "HEAD: [commit]"
|
||||||
|
else if(!originmastercommit)
|
||||||
|
msg += "No commit information"
|
||||||
|
|
||||||
|
return msg.Join("\n")
|
||||||
|
|
||||||
/datum/getrev/proc/GetTestMergeInfo(header = TRUE)
|
/datum/getrev/proc/GetTestMergeInfo(header = TRUE)
|
||||||
if(!testmerge.len)
|
if(!testmerge.len)
|
||||||
@@ -57,7 +53,10 @@
|
|||||||
set name = "Show Server Revision"
|
set name = "Show Server Revision"
|
||||||
set desc = "Check the current server code revision"
|
set desc = "Check the current server code revision"
|
||||||
|
|
||||||
|
var/list/msg = list("")
|
||||||
|
// Round ID
|
||||||
if(GLOB.round_id)
|
if(GLOB.round_id)
|
||||||
|
<<<<<<< HEAD
|
||||||
to_chat(src, "<b>Round ID:</b> [GLOB.round_id]")
|
to_chat(src, "<b>Round ID:</b> [GLOB.round_id]")
|
||||||
if(GLOB.revdata.originmastercommit)
|
if(GLOB.revdata.originmastercommit)
|
||||||
to_chat(src, "<b>Server revision compiled on:</b> [GLOB.revdata.date]")
|
to_chat(src, "<b>Server revision compiled on:</b> [GLOB.revdata.date]")
|
||||||
@@ -72,15 +71,33 @@
|
|||||||
to_chat(src, "Revision: [GLOB.revdata.commit]")
|
to_chat(src, "Revision: [GLOB.revdata.commit]")
|
||||||
if(!check_rights_for(src, R_ADMIN)) //yogs
|
if(!check_rights_for(src, R_ADMIN)) //yogs
|
||||||
return //yogs
|
return //yogs
|
||||||
|
=======
|
||||||
|
msg += "<b>Round ID:</b> [GLOB.round_id]"
|
||||||
|
|
||||||
|
// Revision information
|
||||||
|
var/datum/getrev/revdata = GLOB.revdata
|
||||||
|
msg += "<b>Server revision compiled on:</b> [revdata.date]"
|
||||||
|
var/pc = revdata.originmastercommit
|
||||||
|
if(pc)
|
||||||
|
msg += "Master commit: <a href=\"[CONFIG_GET(string/githuburl)]/commit/[pc]\">[pc]</a>"
|
||||||
|
if(revdata.testmerge.len)
|
||||||
|
msg += revdata.GetTestMergeInfo()
|
||||||
|
if(revdata.commit && revdata.commit != revdata.originmastercommit)
|
||||||
|
msg += "Local commit: [revdata.commit]"
|
||||||
|
else if(!pc)
|
||||||
|
msg += "No commit information"
|
||||||
|
>>>>>>> c0561362ce... Merge pull request #40167 from AutomaticFrenzy/patch/rustg-git
|
||||||
if(world.TgsAvailable())
|
if(world.TgsAvailable())
|
||||||
to_chat(src, "Server tools version: [world.TgsVersion()]")
|
msg += "Server tools version: [world.TgsVersion()]"
|
||||||
to_chat(src, "<b>Current Informational Settings:</b>")
|
|
||||||
to_chat(src, "Protect Authority Roles From Traitor: [CONFIG_GET(flag/protect_roles_from_antagonist)]")
|
// Game mode odds
|
||||||
to_chat(src, "Protect Assistant Role From Traitor: [CONFIG_GET(flag/protect_assistant_from_antagonist)]")
|
msg += "<br><b>Current Informational Settings:</b>"
|
||||||
to_chat(src, "Enforce Human Authority: [CONFIG_GET(flag/enforce_human_authority)]")
|
msg += "Protect Authority Roles From Traitor: [CONFIG_GET(flag/protect_roles_from_antagonist)]"
|
||||||
to_chat(src, "Allow Latejoin Antagonists: [CONFIG_GET(flag/allow_latejoin_antagonists)]")
|
msg += "Protect Assistant Role From Traitor: [CONFIG_GET(flag/protect_assistant_from_antagonist)]"
|
||||||
to_chat(src, "Enforce Continuous Rounds: [length(CONFIG_GET(keyed_list/continuous))] of [config.modes.len] roundtypes")
|
msg += "Enforce Human Authority: [CONFIG_GET(flag/enforce_human_authority)]"
|
||||||
to_chat(src, "Allow Midround Antagonists: [length(CONFIG_GET(keyed_list/midround_antag))] of [config.modes.len] roundtypes")
|
msg += "Allow Latejoin Antagonists: [CONFIG_GET(flag/allow_latejoin_antagonists)]"
|
||||||
|
msg += "Enforce Continuous Rounds: [length(CONFIG_GET(keyed_list/continuous))] of [config.modes.len] roundtypes"
|
||||||
|
msg += "Allow Midround Antagonists: [length(CONFIG_GET(keyed_list/midround_antag))] of [config.modes.len] roundtypes"
|
||||||
if(CONFIG_GET(flag/show_game_type_odds))
|
if(CONFIG_GET(flag/show_game_type_odds))
|
||||||
var/list/probabilities = CONFIG_GET(keyed_list/probability)
|
var/list/probabilities = CONFIG_GET(keyed_list/probability)
|
||||||
if(SSticker.IsRoundInProgress())
|
if(SSticker.IsRoundInProgress())
|
||||||
@@ -101,17 +118,18 @@
|
|||||||
probs[ctag] = 1
|
probs[ctag] = 1
|
||||||
prob_sum += probabilities[ctag]
|
prob_sum += probabilities[ctag]
|
||||||
if(current_odds_differ)
|
if(current_odds_differ)
|
||||||
to_chat(src, "<b>Game Mode Odds for current round:</b>")
|
msg += "<b>Game Mode Odds for current round:</b>"
|
||||||
for(var/ctag in probs)
|
for(var/ctag in probs)
|
||||||
if(probabilities[ctag] > 0)
|
if(probabilities[ctag] > 0)
|
||||||
var/percentage = round(probabilities[ctag] / prob_sum * 100, 0.1)
|
var/percentage = round(probabilities[ctag] / prob_sum * 100, 0.1)
|
||||||
to_chat(src, "[ctag] [percentage]%")
|
msg += "[ctag] [percentage]%"
|
||||||
|
|
||||||
to_chat(src, "<b>All Game Mode Odds:</b>")
|
msg += "<b>All Game Mode Odds:</b>"
|
||||||
var/sum = 0
|
var/sum = 0
|
||||||
for(var/ctag in probabilities)
|
for(var/ctag in probabilities)
|
||||||
sum += probabilities[ctag]
|
sum += probabilities[ctag]
|
||||||
for(var/ctag in probabilities)
|
for(var/ctag in probabilities)
|
||||||
if(probabilities[ctag] > 0)
|
if(probabilities[ctag] > 0)
|
||||||
var/percentage = round(probabilities[ctag] / sum * 100, 0.1)
|
var/percentage = round(probabilities[ctag] / sum * 100, 0.1)
|
||||||
to_chat(src, "[ctag] [percentage]%")
|
msg += "[ctag] [percentage]%"
|
||||||
|
to_chat(src, msg.Join("<br>"))
|
||||||
|
|||||||
@@ -133,6 +133,11 @@ GLOBAL_VAR(restart_counter)
|
|||||||
if(GLOB.round_id)
|
if(GLOB.round_id)
|
||||||
log_game("Round ID: [GLOB.round_id]")
|
log_game("Round ID: [GLOB.round_id]")
|
||||||
|
|
||||||
|
// This was printed early in startup to the world log and config_error.log,
|
||||||
|
// but those are both private, so let's put the commit info in the runtime
|
||||||
|
// log which is ultimately public.
|
||||||
|
log_runtime(GLOB.revdata.get_log_message())
|
||||||
|
|
||||||
/world/Topic(T, addr, master, key)
|
/world/Topic(T, addr, master, key)
|
||||||
TGS_TOPIC //redirect to server tools if necessary
|
TGS_TOPIC //redirect to server tools if necessary
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export BYOND_MAJOR=512
|
|||||||
export BYOND_MINOR=1448
|
export BYOND_MINOR=1448
|
||||||
|
|
||||||
#rust_g git tag
|
#rust_g git tag
|
||||||
export RUST_G_VERSION=0.4.0
|
export RUST_G_VERSION=0.4.1
|
||||||
|
|
||||||
#bsql git tag
|
#bsql git tag
|
||||||
export BSQL_VERSION=v1.4.0.0
|
export BSQL_VERSION=v1.4.0.0
|
||||||
|
|||||||
BIN
rust_g.dll
BIN
rust_g.dll
Binary file not shown.
Reference in New Issue
Block a user