def getAllRevisions(build):
  """Helper method to extract all revisions associated to a build.

  Args:
    build: The build we want to extract the revisions of.

  Returns:
    A list of revision numbers.
  """
  source_stamp = build.getSourceStamp()
  if source_stamp and source_stamp.changes:
    return [change.revision for change in source_stamp.changes]
  try:
    return [build.getProperty('got_revision')]
  except KeyError:
    pass
  try:
    return [build.getProperty('revision')]
  except KeyError:
    pass