Testament small fixes (#16788)

* ReSync with Devel

* ReSync

* Fix Deprecations, Convertion to itself, code style, etc

* Fix Deprecations, Convertion to itself, code style, etc
This commit is contained in:
Juan Carlos 2021-01-22 03:50:28 -03:00 • committed by GitHub
commit f1d165adf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 191 deletions

View file

@ -13,7 +13,6 @@ type
CommitId = distinct string
proc `$`*(id: MachineId): string {.borrow.}
#proc `$`(id: CommitId): string {.borrow.} # not used
var
thisMachine: MachineId
@ -21,9 +20,9 @@ var
thisBranch: string
proc getMachine*(): MachineId =
var name = execProcess("hostname").string.strip
var name = execProcess("hostname").strip
if name.len == 0:
name = when defined(posix): getEnv("HOSTNAME").string
name = when defined(posix): getEnv("HOSTNAME")
else: getEnv("COMPUTERNAME").string
if name.len == 0:
quit "cannot determine the machine name"
@ -32,8 +31,8 @@ proc getMachine*(): MachineId =
proc getCommit(): CommitId =
const commLen = "commit ".len
let hash = execProcess("git log -n 1").string.strip[commLen..commLen+10]
thisBranch = execProcess("git symbolic-ref --short HEAD").string.strip
let hash = execProcess("git log -n 1").strip[commLen..commLen+10]
thisBranch = execProcess("git symbolic-ref --short HEAD").strip
if hash.len == 0 or thisBranch.len == 0: quit "cannot determine git HEAD"
result = CommitId(hash)