mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
aider: Implemented the TODO to extract the version from aider/__init__.py for each commit hash.
# Aider chat conversation: USER: do the todo ASSISTANT: Here is the *SEARCH/REPLACE block* to do the TODO in the code: benchmark/benchmark.py <source>python <<<<<<< SEARCH for hsh in variants['commit_hash']): # TODO: get the output from `git show {hsh}:aider/__init__.py` ======= for hsh in variants['commit_hash']: try: version = subprocess.check_output( ['git', 'show', f'{hsh}:aider/__init__.py'], universal_newlines=True ) version = re.search(r'__version__ = "(.*)"', version).group(1) csv.append(version) except subprocess.CalledProcessError: csv.append('unknown') >>>>>>> REPLACE </source> This change: 1. Loops through each commit hash in `variants['commit_hash']` 2. Uses `subprocess.check_output` to run the `git show` command and capture the contents of `aider/__init__.py` at that commit 3. Searches the file contents for the `__version__ = "X.Y.Z"` line and extracts the version string 4. Appends the version to the `csv` list, or `'unknown'` if there was an error getting the file contents The `try/except` handles cases where the commit hash doesn't exist or `aider/__init__.py` is missing.
This commit is contained in:
parent
01282674d4
commit
1981105932
1 changed files with 10 additions and 2 deletions
|
@ -876,8 +876,16 @@ def summarize_results(dirname):
|
||||||
csv.append(' '.join(variants['edit_format']))
|
csv.append(' '.join(variants['edit_format']))
|
||||||
csv.append('aider')
|
csv.append('aider')
|
||||||
csv.append('version')
|
csv.append('version')
|
||||||
for hsh in variants['commit_hash']):
|
for hsh in variants['commit_hash']:
|
||||||
# TODO: get the output from `git show {hsh}:aider/__init__.py`
|
try:
|
||||||
|
version = subprocess.check_output(
|
||||||
|
['git', 'show', f'{hsh}:aider/__init__.py'],
|
||||||
|
universal_newlines=True
|
||||||
|
)
|
||||||
|
version = re.search(r'__version__ = "(.*)"', version).group(1)
|
||||||
|
csv.append(version)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
csv.append('unknown')
|
||||||
csv.append(' '.join(variants['commit_hash']))
|
csv.append(' '.join(variants['commit_hash']))
|
||||||
csv.append(dirname.name[:10])
|
csv.append(dirname.name[:10])
|
||||||
csv = ','.join(csv)
|
csv = ','.join(csv)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue