From 058dd68b01f4563f309962f0108ac40dc3964e9e Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 11 Apr 2025 15:25:21 +0200 Subject: [PATCH] Change: Disable git pull by default, github actions do that already. --- scripts/eintsgit.py | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/eintsgit.py b/scripts/eintsgit.py index 616d5b3..ad6c60c 100755 --- a/scripts/eintsgit.py +++ b/scripts/eintsgit.py @@ -208,34 +208,44 @@ def eints_download(settings, credits_file): ) -def update_eints_from_git(settings, force): +def update_eints_from_git(settings, force, pull): """ Perform the complete operation from syncing Eints from the repository. @param force: Upload even if no changes. @type force: C{bool} + + @param pull: Pull from remote, or use working copy as-it. + @type pull: C{bool} """ with FileLock(lock_file): - print_info("Check updates from git") - if git_pull(settings) or force: + has_changes = False + if pull: + print_info("Check updates from git") + has_changes = git_pull(settings) + if has_changes or force: print_info("Upload translations") eints_upload(settings) print_info("Done") -def commit_eints_to_git(settings, dry_run): +def commit_eints_to_git(settings, dry_run, pull): """ Perform the complete operation from commit Eints changes to the repository. @param dry_run: Do not commit, leave as modified. @type dry_run: C{bool} + + @param pull: Pull from remote, or use working copy as-it. + @type pull: C{bool} """ with FileLock(lock_file): # Upload first in any case. - print_info("Update from git") - git_pull(settings) + if pull: + print_info("Update from git") + git_pull(settings) print_info("Upload/Merge translations") eints_upload(settings) @@ -267,6 +277,7 @@ def run(): [ "help", "force", + "pull", "dry-run", "base-url=", "project=", @@ -283,6 +294,7 @@ def run(): # Parse options force = False dry_run = False + pull = False settings = Settings() for opt, val in opts: @@ -302,6 +314,9 @@ def run(): --force See individual operations below +--pull + Update working copy from remote + --dry-run See individual operations below @@ -343,6 +358,10 @@ def run(): force = True continue + if opt == "--pull": + pull = True + continue + if opt == "--dry-run": dry_run = True continue @@ -395,10 +414,10 @@ def run(): # Execute operations if do_update: - update_eints_from_git(settings, force) + update_eints_from_git(settings, force, pull) if do_commit: - commit_eints_to_git(settings, dry_run) + commit_eints_to_git(settings, dry_run, pull) sys.exit(0)