in mozci/push.py [0:0]
def make_push_objects(**kwargs):
try:
if "from_date" in kwargs and "to_date" in kwargs:
# Load by date range
pushes_data = data.handler.get("push_revisions", **kwargs)
elif "nb" in kwargs:
# Load latest pushes
pushes_data = data.handler.get("pushes", **kwargs)
else:
raise Exception(
"Unsupported parameters (either from_date and to_date or nb are required)"
)
except MissingDataError:
return []
pushes = []
for push_data in pushes_data:
extra = {}
if "branch" in kwargs:
extra = {"branch": kwargs["branch"]}
cur = Push(push_data["revs"], **extra)
# avoids the need to query hgmo to find this info
cur._id = push_data["pushid"]
cur._date = push_data["date"]
pushes.append(cur)
pushes.sort(key=lambda p: p._id)
for i, cur in enumerate(pushes):
if i != 0:
cur._parent = pushes[i - 1]
if i != len(pushes) - 1:
cur._child = pushes[i + 1]
return pushes