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

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 of rev .