diff options
Diffstat (limited to 'bin/pick/core.py')
-rw-r--r-- | bin/pick/core.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/pick/core.py b/bin/pick/core.py index e10f7416580..fe5af9d8db2 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -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 [] |