Subject: [PATCH 1/4] pull: '--list-generations' doesn't list package changes by default.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 9 Feb 2022 23:17:09 +0100

* guix/scripts/pull.scm (show-help, %options): Add "--details".
(process-query): Honor it.
* doc/guix.texi (Invoking guix pull): Document it.
---
 doc/guix.texi         | 15 +++++++++------
 guix/scripts/pull.scm | 19 +++++++++++++++----
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 583ba1c61d..5ef750786f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4426,18 +4426,12 @@ Generation 2	Jun 11 2018 11:02:49
     repository URL: https://git.savannah.gnu.org/git/guix.git
     branch: origin/master
     commit: e0cc7f669bec22c37481dd03a7941c7d11a64f1d
-  2 new packages: keepalived, libnfnetlink
-  6 packages upgraded: emacs-nix-mode@@2.0.4,
-    guile2.0-guix@@0.14.0-12.77a1aac, guix@@0.14.0-12.77a1aac,
-    heimdal@@7.5.0, milkytracker@@1.02.00, nix@@2.0.4
 
 Generation 3	Jun 13 2018 23:31:07	(current)
   guix 844cc1c
     repository URL: https://git.savannah.gnu.org/git/guix.git
     branch: origin/master
     commit: 844cc1c8f394f03b404c5bb3aee086922373490c
-  28 new packages: emacs-helm-ls-git, emacs-helm-mu, @dots{}
-  69 packages upgraded: borg@@1.1.6, cheese@@3.28.0, @dots{}
 @end example
 
 @xref{Invoking guix describe, @command{guix describe}}, for other ways to
@@ -4507,6 +4501,15 @@ is provided, the subset of generations that match @var{pattern}.
 The syntax of @var{pattern} is the same as with @code{guix package
 --list-generations} (@pxref{Invoking guix package}).
 
+By default, this prints information about the channels used in each
+revision as well as the corresponding news entries.  If you pass
+@option{--details}, it will also print the list of packages added and
+upgraded in each generation compared to the previous one.
+
+@item --details
+Instruct @option{--list-generations} to display more information about
+the differences between subsequent generations---see above.
+
 @item --roll-back
 @cindex rolling back
 @cindex undoing transactions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index fb8ce50fa7..707f1f0929 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2013-2015, 2017-2022 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2017 Marius Bakke <[email-masked]>
 ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice <[email-masked]>
 ;;;
@@ -104,6 +104,8 @@ (define (show-help)
   (display (G_ "
   -l, --list-generations[=PATTERN]
                          list generations matching PATTERN"))
+  (display (G_ "
+      --details          show details when listing generations"))
   (display (G_ "
       --roll-back        roll back to the previous generation"))
   (display (G_ "
@@ -138,6 +140,9 @@ (define %options
                  (lambda (opt name arg result)
                    (cons `(query list-generations ,arg)
                          result)))
+         (option '("details") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'details? #t result)))
          (option '("roll-back") #f #f
                  (lambda (opt name arg result)
                    (cons '(generation roll-back)
@@ -640,17 +645,23 @@ (define (package-alist generation)
 
 (define (process-query opts profile)
   "Process any query on PROFILE specified by OPTS."
+  (define details?
+    (assoc-ref opts 'details?))
+
   (match (assoc-ref opts 'query)
     (('list-generations pattern)
      (define (list-generations profile numbers)
        (match numbers
          ((first rest ...)
           (display-profile-content profile first)
+
           (let loop ((numbers numbers))
             (match numbers
               ((first second rest ...)
-               (display-profile-content-diff profile
-                                             first second)
+               (if details?
+                   (display-profile-content-diff profile
+                                                 first second)
+                   (display-profile-content profile second))
                (display-channel-news (generation-file-name profile second)
                                      (generation-file-name profile first))
                (loop (cons second rest)))
@@ -754,7 +765,7 @@ (define (environment-variable)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _‌)
+  (define (no-arguments arg _)
     (leave (G_ "~A: extraneous argument~%") arg))
 
   (with-error-handling
-- 
2.34.0