From 1e6e2e862ec615fecad086ca162c044d97836c69 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 27 Feb 2023 16:02:47 +0100 Subject: [PATCH] tools/pick-complete-translations.py: cherry-pick in chrono-order repo.iter_commits() does reverse chronological order by default, which is wrong for this, since it goes backwards through the git history. --- tools/pick-complete-translations.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/pick-complete-translations.py b/tools/pick-complete-translations.py index 9c03dd8b7..cffa85b0b 100755 --- a/tools/pick-complete-translations.py +++ b/tools/pick-complete-translations.py @@ -1,6 +1,14 @@ #!/usr/bin/python3 # # cherry-pick complete translations from weblate +# +# This is too hard to get working right, so really, this should be +# punted to the translators. Weblate can automatically file a merge +# request when a language hits 100% translated and 0% failed. +# +# This will probably fail to cherry-pick if a commit contains more +# than one language. In that case, reset everything, then manually +# cherry-pick that one commit and push it. Then run this again. import git import os @@ -99,15 +107,12 @@ for locale in sorted(merge_locales): a = app_locales.get(locale) m = metadata_locales.get(locale) paths = get_paths_tuple(locale) - commits = list( - repo.iter_commits( - str(weblate.refs.master) + '...' + str(upstream.refs.master), - paths=paths, - max_count=10, - ) - ) - - for commit in reversed(commits): + for commit in repo.iter_commits( + str(weblate.refs.master) + '...' + str(upstream.refs.master), + paths=paths, + max_count=10, + reverse=True, + ): has_a = False has_m = False for i in commit.iter_items(repo, commit.hexsha, paths=[paths[2]]):