Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8389b9e

Browse files
committed
More uses of the Git class, thanks to AA-Turner review.
1 parent 6c8d0b4 commit 8389b9e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

build_docs.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def locate_nearest_version(available_versions, target_version):
340340
return tuple_to_version(found)
341341

342342

343-
def translation_branch(locale_repo, locale_clone_dir, needed_version: str):
343+
def translation_branch(repo: Git, needed_version: str):
344344
"""Some cpython versions may be untranslated, being either too old or
345345
too new.
346346
@@ -350,8 +350,7 @@ def translation_branch(locale_repo, locale_clone_dir, needed_version: str):
350350
It could be enhanced to return tags, if needed, just return the
351351
tag as a string (without the `origin/` branch prefix).
352352
"""
353-
Git(locale_repo, locale_clone_dir).clone()
354-
remote_branches = run(["git", "-C", locale_clone_dir, "branch", "-r"]).stdout
353+
remote_branches = repo.run("branch", "-r").stdout
355354
branches = re.findall(r"/([0-9]+\.[0-9]+)$", remote_branches, re.M)
356355
return "origin/" + locate_nearest_version(branches, needed_version)
357356

@@ -677,9 +676,7 @@ def clone_translation(self):
677676
)
678677
repo = Git(locale_repo, locale_clone_dir)
679678
repo.clone()
680-
repo.switch(
681-
translation_branch(locale_repo, locale_clone_dir, self.version.name)
682-
)
679+
repo.switch(translation_branch(repo, self.version.name))
683680

684681
def clone_cpython(self):
685682
repo = Git("https://github.com/python/cpython.git", self.checkout)

0 commit comments

Comments
 (0)