Skip to content

Commit 4e8471f

Browse files
Apply suggestions from Maciek
Co-authored-by: Maciej Olko <[email protected]>
1 parent 40c5d37 commit 4e8471f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

completion.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ def get_completion(
5050

5151
try:
5252
# Fetch commit from before 30 days ago and checkout
53-
commit = subprocess.check_output(
54-
['git', 'rev-list', '-n', '1', '--before="30 days ago"', 'HEAD'],
55-
cwd=clone_path,
56-
text=True,
57-
).strip()
58-
subprocess.run(['git', 'checkout', commit], cwd=clone_path, check=True)
59-
with TemporaryDirectory() as tmpdir2:
53+
repo = git.Repo(clone_path)
54+
commit = next(repo.iter_commits('HEAD', max_count=1, before="30 days ago"))
55+
repo.git.checkout(commit.hexsha)
56+
with TemporaryDirectory() as tmpdir:
6057
month_ago_completion = potodo.merge_and_scan_path(
6158
clone_path,
6259
pot_path=Path(clones_dir, 'cpython/Doc/build/gettext'),

0 commit comments

Comments
 (0)