def hg_revision_timestamp(rev):
  try:
    revset = 'last(sort(ancestors(%s), date))' % rev
    res = subprocess.check_output(['hg', 'log', '-r', revset, '--template', '{date}'], stderr=subprocess.STDOUT)
    return float(res.strip())
  except subprocess.CalledProcessError:
    return None
Returns the timestamp (in seconds) of 'rev', or None if cannot be determined.
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/hg_revision_timestamp