mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
feat: Use Git to get the last modified date
This commit is contained in:
parent
f6c9f86ea4
commit
f2c7ba3f36
1 changed files with 11 additions and 5 deletions
|
@ -291,7 +291,7 @@ Submit results by opening a PR with edits to the
|
||||||
By Paul Gauthier,
|
By Paul Gauthier,
|
||||||
last updated
|
last updated
|
||||||
<!--[[[cog
|
<!--[[[cog
|
||||||
import os
|
import subprocess
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
|
@ -300,10 +300,16 @@ files = [
|
||||||
'aider/website/_data/refactor_leaderboard.yml'
|
'aider/website/_data/refactor_leaderboard.yml'
|
||||||
]
|
]
|
||||||
|
|
||||||
mod_times = [os.path.getmtime(file) for file in files]
|
def get_last_modified_date(file):
|
||||||
latest_mod_time = max(mod_times)
|
result = subprocess.run(['git', 'log', '-1', '--format=%ct', file], capture_output=True, text=True)
|
||||||
mod_date = datetime.datetime.fromtimestamp(latest_mod_time)
|
if result.returncode == 0:
|
||||||
cog.out(f"{mod_date.strftime('%B %d, %Y.')}")
|
timestamp = int(result.stdout.strip())
|
||||||
|
return datetime.datetime.fromtimestamp(timestamp)
|
||||||
|
return datetime.datetime.min
|
||||||
|
|
||||||
|
mod_dates = [get_last_modified_date(file) for file in files]
|
||||||
|
latest_mod_date = max(mod_dates)
|
||||||
|
cog.out(f"{latest_mod_date.strftime('%B %d, %Y.')}")
|
||||||
]]]-->
|
]]]-->
|
||||||
August 09, 2024.
|
August 09, 2024.
|
||||||
<!--[[[end]]]-->
|
<!--[[[end]]]-->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue