udpated the compiler and tester to use getOrDefault

This commit is contained in:
Araq 2015-10-13 14:10:33 +02:00
commit 8be9e46403
19 changed files with 82 additions and 59 deletions

View file

@ -8,7 +8,7 @@
import strutils, db_sqlite, os, osproc
var db: TDbConn
var db: DbConn
proc createDb() =
db.exec(sql"""
@ -61,7 +61,7 @@ var
proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip
proc getMachine*(db: TDbConn): MachineId =
proc getMachine*(db: DbConn): MachineId =
var name = "hostname"()
if name.len == 0:
name = when defined(posix): getenv"HOSTNAME".string
@ -76,7 +76,7 @@ proc getMachine*(db: TDbConn): MachineId =
result = db.insertId(sql"insert into Machine(name, os, cpu) values (?,?,?)",
name, system.hostOS, system.hostCPU).MachineId
proc getCommit(db: TDbConn): CommitId =
proc getCommit(db: DbConn): CommitId =
const commLen = "commit ".len
let hash = "git log -n 1"()[commLen..commLen+10]
let branch = "git symbolic-ref --short HEAD"()