[projects/git-slug] Postęp i podsumowanie dla 'git pld update'

arekm arekm at pld-linux.org
Tue May 12 15:08:55 CEST 2026


commit 1c4b9b552418a3dbb612be06e4cc06149b105b8a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Apr 7 09:49:10 2026 +0200

    Postęp i podsumowanie dla 'git pld update'
    
    Wcześniej między 'Fetched ...' a powrotem do shella nie było żadnej
    informacji co się dzieje — przy 2750 pakietach perl-* użytkownik widział
    jedną linię startową i ciszę aż do końca.  Dodane:
    
    - 'Checking N local repo(s) for updates...' przed run_worker, żeby
      było widać że praca się zaczęła
    - 'Updated X repo(s); Y already up to date' lub 'All N repo(s) already
      up to date' po zakończeniu, żeby było wiadomo co się stało
    
    Przy okazji uściślony pierwszy komunikat: zamiast 'Fetched N package
    ref(s)' (sugerujące N osobnych operacji sieciowych) jest 'Fetched refs
    from server' — git archive pobiera cały plik Refs jako tarball jednym
    zapytaniem, a filtrowanie po wzorcu odbywa się po stronie klienta.
    Liczba dopasowanych pakietów i tak pojawia się w następnej linii
    ('Checking N local repo(s)...'), więc dublowanie nie ma sensu.
    
    Wszystkie nowe komunikaty respektują --quiet.

 slug.py                     | 20 ++++++++++++++++++--
 tests/test_failure_paths.py |  2 +-
 2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/slug.py b/slug.py
index 55f1896..d8aa7c3 100755
--- a/slug.py
+++ b/slug.py
@@ -619,8 +619,8 @@ def fetch_packages(options, return_all=False):
     import datetime
     refs_time = datetime.datetime.fromtimestamp(
         branch_refs.refs_mtime, datetime.timezone.utc).astimezone().strftime('%Y-%m-%d %H:%M:%S %Z')
-    print('Fetched {} package ref(s) (last change on server: {})'.format(
-        len(branch_refs.heads), refs_time), file=sys.stderr)
+    print('Fetched refs from server (last change: {})'.format(refs_time),
+          file=sys.stderr)
     had_errors = False
     pkgs_new = []
     if options.newpkgs:
@@ -645,12 +645,28 @@ def fetch_packages(options, return_all=False):
             gitrepo = GitRepo(os.path.join(options.packagesdir, pkgdir))
             args.append((gitrepo, branch_refs.heads[pkgdir], options))
 
+    if args and not options.quiet:
+        print('Checking {} local repo(s) for updates...'.format(len(args)),
+              file=sys.stderr)
+
     fetch_results = run_worker(fetch_package, options, args)
     # Separate successful fetches from errors
     updated_repos = [r for r in fetch_results if not isinstance(r, _FetchError)]
     if len(updated_repos) < len(fetch_results):
         had_errors = True
 
+    if args and not options.quiet:
+        # fetch_package returns None when nothing needed fetching, so
+        # run_worker filters those out — len(args) - len(fetch_results)
+        # is the count of repos already up to date.
+        up_to_date = len(args) - len(fetch_results)
+        if updated_repos:
+            print('Updated {} repo(s); {} already up to date'.format(
+                len(updated_repos), up_to_date), file=sys.stderr)
+        else:
+            print('All {} repo(s) already up to date'.format(up_to_date),
+                  file=sys.stderr)
+
     if options.prune:
         # Prune needs all-branches refs to know which repos still exist
         # upstream.  If we already fetched with ['*'], reuse those refs
diff --git a/tests/test_failure_paths.py b/tests/test_failure_paths.py
index a1a2664..563b8bc 100644
--- a/tests/test_failure_paths.py
+++ b/tests/test_failure_paths.py
@@ -225,7 +225,7 @@ def test_fetch_packages_clone_mode_only_fetches_new_repos(monkeypatch, make_opti
 
     assert result == ["updated-pkg-new"]
     assert options.had_errors is False
-    assert "Fetched 2 package ref(s) (last change on server:" in capsys.readouterr().err
+    assert "Fetched refs from server (last change:" in capsys.readouterr().err
     assert captured["init_args"] == [("pkg-new", options)]
     assert len(captured["fetch_args"]) == 1
     assert captured["fetch_args"][0][0].path == "/pkgs/pkg-new"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4a7e426b8f1a3571094b5dc89412bc49b8f29666



More information about the pld-cvs-commit mailing list