mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 17:10:32 +01:00
pick/core: Add a method for updating commits
This is almost the same as the one in the ui, but without the UI elements. It would be nice to share code between them, but I'm not sure how to do that yet.
This commit is contained in:
parent
29960e0b4a
commit
3348844bc4
1 changed files with 20 additions and 0 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
import asyncio
|
||||
import enum
|
||||
import itertools
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
|
|
@ -372,6 +373,25 @@ async def gather_commits(version: str, previous: typing.List['Commit'],
|
|||
return commits
|
||||
|
||||
|
||||
async def update_commits() -> None:
|
||||
"""Gather all new commits and update the on-disk cache.
|
||||
"""
|
||||
commits = load()
|
||||
with open('VERSION', 'r') as f:
|
||||
version = '.'.join(f.read().split('.')[:2])
|
||||
if commits:
|
||||
sha = commits[0].sha
|
||||
else:
|
||||
sha = f'{version}-branchpoint'
|
||||
|
||||
if new := await get_new_commits(sha):
|
||||
collected_commits = await gather_commits(version, commits, new)
|
||||
else:
|
||||
collected_commits = []
|
||||
|
||||
save(itertools.chain(collected_commits, commits))
|
||||
|
||||
|
||||
def load() -> typing.List['Commit']:
|
||||
if not pick_status_json.exists():
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue