diff --git a/code/__DEFINES/rust_g.dm b/code/__DEFINES/rust_g.dm index a905fd5186fb7..ccd5b92c79d37 100644 --- a/code/__DEFINES/rust_g.dm +++ b/code/__DEFINES/rust_g.dm @@ -3,5 +3,8 @@ #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) /proc/rustg_log_close_all() return call(RUST_G, "log_close_all")() diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index 46de2c5c9232c..994269e52a96b 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -1,44 +1,40 @@ /datum/getrev - var/originmastercommit - var/commit - var/list/testmerge = list() + var/commit // git rev-parse HEAD var/date + var/originmastercommit // git rev-parse origin/master + var/list/testmerge = list() /datum/getrev/New() testmerge = world.TgsTestMerges() - log_world("Running /tg/ revision:") var/datum/tgs_revision_information/revinfo = world.TgsRevision() if(revinfo) commit = revinfo.commit originmastercommit = revinfo.origin_commit else - var/list/logs = world.file2list(".git/logs/HEAD") - if(logs.len) - logs = splittext(logs[logs.len - 1], " ") - date = unix2date(text2num(logs[5])) - 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] + commit = rustg_git_revparse("HEAD") + if(commit) + date = rustg_git_commit_date(commit) + originmastercommit = rustg_git_revparse("origin/master") + + // goes to DD log and config_error.txt + log_world(get_log_message()) - if(testmerge.len) - log_world(commit) - for(var/line in testmerge) - if(line) - var/datum/tgs_revision_information/test_merge/tm = line - var/tmcommit = tm.commit - 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) - log_world("Based off origin/master commit [originmastercommit]") - else if(originmastercommit) - log_world(originmastercommit) +/datum/getrev/proc/get_log_message() + var/list/msg = list() + msg += "Running /tg/ revision: [date]" + if(originmastercommit) + msg += "origin/master: [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) if(!testmerge.len) @@ -57,28 +53,34 @@ set name = "Show Server Revision" set desc = "Check the current server code revision" + var/list/msg = list("") + // Round ID if(GLOB.round_id) - to_chat(src, "Round ID: [GLOB.round_id]") - if(GLOB.revdata.originmastercommit) - to_chat(src, "Server revision compiled on: [GLOB.revdata.date]") - var/prefix = "" - if(GLOB.revdata.testmerge.len) - to_chat(src, GLOB.revdata.GetTestMergeInfo()) - prefix = "Based off origin/master commit: " - var/pc = GLOB.revdata.originmastercommit - to_chat(src, "[prefix][copytext(pc, 1, min(length(pc), 11))]") - else - to_chat(src, "Master revision unknown") - to_chat(src, "Revision: [GLOB.revdata.commit]") + msg += "Round ID: [GLOB.round_id]" + + // Revision information + var/datum/getrev/revdata = GLOB.revdata + msg += "Server revision compiled on: [revdata.date]" + var/pc = revdata.originmastercommit + if(pc) + msg += "Master commit: [pc]" + 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" if(world.TgsAvailable()) - to_chat(src, "Server tools version: [world.TgsVersion()]") - to_chat(src, "Current Informational Settings:") - to_chat(src, "Protect Authority Roles From Traitor: [CONFIG_GET(flag/protect_roles_from_antagonist)]") - to_chat(src, "Protect Assistant Role From Traitor: [CONFIG_GET(flag/protect_assistant_from_antagonist)]") - to_chat(src, "Enforce Human Authority: [CONFIG_GET(flag/enforce_human_authority)]") - to_chat(src, "Allow Latejoin Antagonists: [CONFIG_GET(flag/allow_latejoin_antagonists)]") - to_chat(src, "Enforce Continuous Rounds: [length(CONFIG_GET(keyed_list/continuous))] of [config.modes.len] roundtypes") - to_chat(src, "Allow Midround Antagonists: [length(CONFIG_GET(keyed_list/midround_antag))] of [config.modes.len] roundtypes") + msg += "Server tools version: [world.TgsVersion()]" + + // Game mode odds + msg += "
Current Informational Settings:" + msg += "Protect Authority Roles From Traitor: [CONFIG_GET(flag/protect_roles_from_antagonist)]" + msg += "Protect Assistant Role From Traitor: [CONFIG_GET(flag/protect_assistant_from_antagonist)]" + msg += "Enforce Human Authority: [CONFIG_GET(flag/enforce_human_authority)]" + 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)) var/list/probabilities = CONFIG_GET(keyed_list/probability) if(SSticker.IsRoundInProgress()) @@ -99,17 +101,18 @@ probs[ctag] = 1 prob_sum += probabilities[ctag] if(current_odds_differ) - to_chat(src, "Game Mode Odds for current round:") + msg += "Game Mode Odds for current round:" for(var/ctag in probs) if(probabilities[ctag] > 0) var/percentage = round(probabilities[ctag] / prob_sum * 100, 0.1) - to_chat(src, "[ctag] [percentage]%") + msg += "[ctag] [percentage]%" - to_chat(src, "All Game Mode Odds:") + msg += "All Game Mode Odds:" var/sum = 0 for(var/ctag in probabilities) sum += probabilities[ctag] for(var/ctag in probabilities) if(probabilities[ctag] > 0) var/percentage = round(probabilities[ctag] / sum * 100, 0.1) - to_chat(src, "[ctag] [percentage]%") + msg += "[ctag] [percentage]%" + to_chat(src, msg.Join("
")) diff --git a/code/game/world.dm b/code/game/world.dm index 2dfc21b8ca741..ae4f776d829d8 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -130,6 +130,11 @@ GLOBAL_VAR(restart_counter) if(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) TGS_TOPIC //redirect to server tools if necessary diff --git a/dependencies.sh b/dependencies.sh index 054736c5f8dc6..1b61b37c882cf 100755 --- a/dependencies.sh +++ b/dependencies.sh @@ -10,7 +10,7 @@ export BYOND_MAJOR=512 export BYOND_MINOR=1448 #rust_g git tag -export RUST_G_VERSION=0.4.0 +export RUST_G_VERSION=0.4.1 #bsql git tag export BSQL_VERSION=v1.4.0.0 diff --git a/rust_g.dll b/rust_g.dll index 44e38ef0dd4b4..ec072b01b00eb 100644 Binary files a/rust_g.dll and b/rust_g.dll differ