diff --git a/code/datums/revision.dm b/code/datums/revision.dm
index 50c616fc94f..d1cb3ff0619 100644
--- a/code/datums/revision.dm
+++ b/code/datums/revision.dm
@@ -11,12 +11,26 @@ GLOBAL_PROTECT(revision_info) // Dont mess with this
var/commit_hash
/// Date that this commit was made
var/commit_date
+ /// Origin commit (Only set if running TGS, and will only be different if the server is running testmerges)
+ var/origin_commit
+ /// List of testmerges (If applicable)
+ var/list/testmerges = list()
+// Pull info from the rust DLL
/datum/code_revision/New()
commit_hash = rustg_git_revparse("HEAD")
if(commit_hash)
commit_date = rustg_git_commit_date(commit_hash)
+// Pull info from TGS
+/datum/code_revision/proc/load_tgs_info()
+ testmerges = world.TgsTestMerges()
+ var/datum/tgs_revision_information/revinfo = world.TgsRevision()
+ if(revinfo)
+ commit_hash = revinfo.commit
+ origin_commit = revinfo.origin_commit
+ commit_date = revinfo.timestamp
+
/**
* Code Revision Logging Helper
*
@@ -24,17 +38,50 @@ GLOBAL_PROTECT(revision_info) // Dont mess with this
*/
/datum/code_revision/proc/log_info()
// Put revision info in the world log
- var/logmsg
+ var/list/logmsgs = list()
if(commit_hash && commit_date)
- logmsg = "Running ParaCode commit: [commit_hash] (Date: [commit_date])"
+ logmsgs += "Running ParaCode commit: [commit_hash] (Date: [commit_date])"
else
- logmsg = "Unable to determine revision info! Code may not be running in a git repository."
+ logmsgs += "Unable to determine revision info! Code may not be running in a git repository."
+
+ // Check if we were on TGS
+ if(world.TgsAvailable())
+ if(origin_commit && (commit_hash != origin_commit)) // Commits are different, theres likely a testmerge
+ logmsgs += "Origin commit: [origin_commit]"
+ if(length(testmerges))
+ logmsgs += "The following PRs are testmerged:"
+ for(var/pr in testmerges)
+ var/datum/tgs_revision_information/test_merge/tm = pr
+ logmsgs += "PR #[tm.number] at commit [tm.head_commit]"
+ // Log these in blackbox so they can be attributed to round IDs easier in the future
+ SSblackbox.record_feedback("associative", "testmerged_prs", 1, list("number" = "[tm.number]", "commit" = "[tm.head_commit]", "title" = "[tm.title]", "author" = "[tm.author]"))
+
+ var/logmsg = logmsgs.Join("\n")
// Log it in all these
log_world(logmsg)
log_runtime_txt(logmsg)
log_runtime_summary(logmsg)
+
+/**
+ * Testmerge Chat Message Helper
+ *
+ * Formats testmerged PRs into a nice message
+ * Arguments:
+ * * header - Should a header be sent too
+ */
+/datum/code_revision/proc/get_testmerge_chatmessage(header = FALSE)
+ var/list/msg = list()
+ if(header)
+ msg += "The following PRs are currently testmerged:"
+
+ for(var/pr in GLOB.revision_info.testmerges)
+ var/datum/tgs_revision_information/test_merge/tm = pr
+ msg += "- PR #[tm.number] - [tm.title]"
+
+ return msg.Join("
")
+
/client/verb/get_revision_info()
set name = "Get Revision Info"
set category = "OOC"
@@ -48,9 +95,14 @@ GLOBAL_PROTECT(revision_info) // Dont mess with this
// Commit info
if(GLOB.revision_info.commit_hash && GLOB.revision_info.commit_date)
msg += "Server Commit: [GLOB.revision_info.commit_hash] (Date: [GLOB.revision_info.commit_date])"
+ if(GLOB.revision_info.origin_commit && (GLOB.revision_info.commit_hash != GLOB.revision_info.origin_commit))
+ msg += "Origin Commit: [GLOB.revision_info.origin_commit]"
else
msg += "Server Commit: Unable to determine"
+ if(world.TgsAvailable() && length(GLOB.revision_info.testmerges))
+ msg += "Active Testmerges:"
+ msg += GLOB.revision_info.get_testmerge_chatmessage(FALSE)
// Show server BYOND version
msg += "Server BYOND Version: [world.byond_version].[world.byond_build]"
diff --git a/code/game/world.dm b/code/game/world.dm
index 48063b2395d..0cb7e750c77 100644
--- a/code/game/world.dm
+++ b/code/game/world.dm
@@ -22,7 +22,7 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG)
// This needs to happen early, otherwise people can get a null species, nuking their character
makeDatumRefLists()
- TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_TRUSTED) // creates a new TGS object
+ InitTGS() // creates a new TGS object
log_world("World loaded at [time_stamp()]")
log_world("[length(GLOB.vars) - length(GLOB.gvars_datum_in_built_vars)] global variables")
GLOB.revision_info.log_info()
@@ -60,6 +60,10 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG)
#endif
+/world/proc/InitTGS()
+ TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_TRUSTED) // creates a new TGS object
+ GLOB.revision_info.load_tgs_info() // Loads git and TM info from TGS itself
+
// This is basically a replacement for hook/startup. Please dont shove random bullshit here
// If it doesnt need to happen IMMEDIATELY on world load, make a subsystem for it
/world/proc/startup_procs()
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 5571292adac..3f3d50ed8d5 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -391,8 +391,13 @@
GLOB.panic_bunker_enabled = FALSE
message_admins("Panic bunker has been automatically disabled due to playercount dropping below [threshold]")
+ // Tell clients about active testmerges
+ if(world.TgsAvailable() && length(GLOB.revision_info.testmerges))
+ to_chat(src, GLOB.revision_info.get_testmerge_chatmessage(TRUE))
+
INVOKE_ASYNC(src, .proc/cid_count_check)
+
/client/proc/is_connecting_from_localhost()
var/localhost_addresses = list("127.0.0.1", "::1") // Adresses
if(!isnull(address) && (address in localhost_addresses))