mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24: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,
|
||||
last updated
|
||||
<!--[[[cog
|
||||
import os
|
||||
import subprocess
|
||||
import datetime
|
||||
|
||||
files = [
|
||||
|
@ -300,10 +300,16 @@ files = [
|
|||
'aider/website/_data/refactor_leaderboard.yml'
|
||||
]
|
||||
|
||||
mod_times = [os.path.getmtime(file) for file in files]
|
||||
latest_mod_time = max(mod_times)
|
||||
mod_date = datetime.datetime.fromtimestamp(latest_mod_time)
|
||||
cog.out(f"{mod_date.strftime('%B %d, %Y.')}")
|
||||
def get_last_modified_date(file):
|
||||
result = subprocess.run(['git', 'log', '-1', '--format=%ct', file], capture_output=True, text=True)
|
||||
if result.returncode == 0:
|
||||
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.
|
||||
<!--[[[end]]]-->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue