def hg_revision_timestamp(rev):
  """Returns the timestamp (in seconds) of 'rev', or None if cannot be determined.

  Since mq (and non-linear history in general) makes it possible have revisions dated
  before their true "commit" date, we must find the newest ancestor of the given revision.
  """
  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
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/hg_revision_timestamp/operator `%` -> `-`