##[ internal API for now, API subject to change ]## # xxx move other git utilities here; candidate for stdlib. import std/[os, osproc, strutils, tempfiles] const commitHead* = "HEAD" template retryCall*(maxRetry = 3, backoffDuration = 1.0, call: untyped): bool = ## Retry `call` up to `maxRetry` times with exponential backoff and initial ## duraton of `backoffDuration` seconds. ## This is in particular useful for network commands that can fail. runnableExamples: doAssert not retryCall(maxRetry = 2, backoffDuration = 0.1, false) var i = 0 doAssert: retryCall(maxRetry = 3, backoffDuration = 0.1, (i.inc; i >= 3)) doAssert retryCall(call = true) var result = false var t = backoffDuration for i in 0..