show-server-revision tells if test pr is merged

This commit is contained in:
Jordie0608
2016-03-11 20:35:10 +11:00
parent 3a6a038322
commit c3f28bb395
3 changed files with 26 additions and 23 deletions
+23 -20
View File
@@ -1,38 +1,41 @@
var/global/datum/getrev/revdata = new()
/datum/getrev
var/revision
var/parentcommit
var/commit
var/testmerge
var/date
var/showinfo
/datum/getrev/New()
var/list/head_log = file2list(".git/logs/HEAD", "\n")
for(var/line=head_log.len, line>=1, line--)
if(head_log[line])
var/list/last_entry = splittext(head_log[line], " ")
if(last_entry.len < 2)
continue
revision = last_entry[2]
// Get date/time
if(last_entry.len >= 5)
var/unix_time = text2num(last_entry[5])
if(unix_time)
date = unix2date(unix_time)
break
var/head_file = return_file_text(".git/logs/HEAD")
var/regex/head_log = new("(\\w{40}) (\\w{40}).+> (\\d{10}).+\n\\Z")
head_log.Find(head_file)
parentcommit = head_log.group[1]
commit = head_log.group[2]
var/unix_time = text2num(head_log.group[3])
if(SERVERTOOLS && fexists("..\\..\\prtestjob.lk"))
testmerge = return_file_text("..\\..\\prtestjob.lk")
date = unix2date(unix_time)
world.log << "Running /tg/ revision:"
world.log << date
world.log << revision
world.log << "[date]"
world.log << commit
if(testmerge)
world.log << "Test merge active of PR #[testmerge]"
world.log << "Based off master commit [parentcommit]"
world.log << "Current map - [MAP_NAME]" //can't think of anywhere better to put it
return
/client/verb/showrevinfo()
set category = "OOC"
set name = "Show Server Revision"
set desc = "Check the current server code revision"
if(revdata.revision)
if(revdata.commit)
src << "<b>Server revision compiled on:</b> [revdata.date]"
src << "<a href='[config.githuburl]/commit/[revdata.revision]'>[revdata.revision]</a>"
if(revdata.testmerge)
src << "Test merge active of PR <a href='[config.githuburl]/pull/[revdata.testmerge]'>#[revdata.testmerge]</a>"
src << "Based off master commit <a href='[config.githuburl]/commit/[revdata.parentcommit]'>[revdata.parentcommit]</a>"
else
src << "<a href='[config.githuburl]/commit/[revdata.commit]'>[revdata.commit]</a>"
else
src << "Revision unknown"
src << "<b>Current Infomational Settings:</b>"
+2 -2
View File
@@ -80,8 +80,8 @@
feedback_set_details("round_start","[time2text(world.realtime)]")
if(ticker && ticker.mode)
feedback_set_details("game_mode","[ticker.mode]")
if(revdata.revision)
feedback_set_details("revision","[revdata.revision]")
if(revdata.commit)
feedback_set_details("revision","[revdata.commit]")
feedback_set_details("server_ip","[world.internet_address]:[world.port]")
if(report)
spawn (rand(waittime_l, waittime_h))
+1 -1
View File
@@ -107,7 +107,7 @@ var/last_irc_status = 0
s["host"] = host ? host : null
s["active_players"] = get_active_player_count()
s["players"] = clients.len
s["revision"] = revdata.revision
s["revision"] = revdata.commit
s["revision_date"] = revdata.date
var/list/adm = get_admin_counts()