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:
parent
3df652b90b
commit
f1d165adf2
6 changed files with 91 additions and 191 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue