@@ -340,7 +340,7 @@ def git_clone(repository: str, directory: Path, branch_or_tag=None):
340340 if directory .exists ():
341341 shutil .rmtree (directory )
342342 logging .info ("Cloning %s into %s" , repository , directory )
343- directory .mkdir (mode = 0o775 )
343+ directory .mkdir (mode = 0o775 , parents = True , exist_ok = True )
344344 run (["git" , "clone" , repository , directory ])
345345 if branch_or_tag :
346346 run (["git" , "-C" , directory , "reset" , "--hard" , branch_or_tag , "--" ])
@@ -394,11 +394,14 @@ def translation_branch(locale_repo, locale_clone_dir, needed_version: str):
394394
395395 This function looks for remote branches on the given repo, and
396396 returns the name of the nearest existing branch.
397+
398+ It could be enhanced to return tags, if needed, just return the
399+ tag as a string (without the `origin/` branch prefix).
397400 """
398401 git_clone (locale_repo , locale_clone_dir )
399402 remote_branches = run (["git" , "-C" , locale_clone_dir , "branch" , "-r" ]).stdout
400403 branches = re .findall (r"/([0-9]+\.[0-9]+)$" , remote_branches , re .M )
401- return locate_nearest_version (branches , needed_version )
404+ return "origin/" + locate_nearest_version (branches , needed_version )
402405
403406
404407@contextmanager
0 commit comments