unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Magali <magalilemes00@gmail.com>,
	"Gábor Boskovits" <boskovits@gmail.com>
Cc: Guix Devel <guix-devel@gnu.org>, Mathieu Othacehe <othacehe@gnu.org>
Subject: Re: [outreachy] Walk through the Git history (guix git {authenticate,log})
Date: Sat, 12 Dec 2020 13:24:02 +0100	[thread overview]
Message-ID: <86lfe3fc0t.fsf@gmail.com> (raw)
In-Reply-To: <e13b1718-aa97-1c9f-8792-b6f3503bcb6a@gmail.com>

Hi Magali,

On Fri, 11 Dec 2020 at 16:01, Magali <magalilemes00@gmail.com> wrote:

> I think #2 is the way to go. It may be more difficult to implement right
> now, but in the future it'll make things easier if we think about adding
> an option that allows us to choose the order the commits will be shown,
> for instance.

Awaiting how to walk the history tree, I am proposing to use the loop as
Mathieu said.  However, ’match’ is preferred over ’car’.  Something
along:

--8<---------------cut here---------------start------------->8---
$ guix repl
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> ,use(guix git)
scheme@(guix-user)> ,use(git)
scheme@(guix-user)> ,use(guix channels)
scheme@(guix-user)> ,use(ice-9 match)
scheme@(guix-user)> ,use(srfi srfi-1)    
scheme@(guix-user)> (define cache (url-cache-directory (channel-url %default-guix-channel)))
scheme@(guix-user)> (define repo (repository-open cache))
scheme@(guix-user)> (define (commit-list repo)
  (let loop ((commit (commit-lookup repo
                                    (reference-target (repository-head repo))))
             (res '()))
    (match (commit-parents commit)
      (() (reverse res))
      ((head . tail)
       (loop head (cons head res))))))

scheme@(guix-user)> (define commits (commit-list repo))
scheme@(guix-user)> ,pp (take commits 5)
$1 = (#<git-commit 2639a99cf31e3ce2970645badf11f15679c893b5>
 #<git-commit f769ad12f1b7834a5fb6c870a6737d2eea495744>
 #<git-commit 8f330aebee504269d4d7188daa85e95503f71888>
 #<git-commit f765577dec0340d035021d030f17b54a3a5fd6b1>
 #<git-commit 72e3614666b8ffb7ecc568cbf4ba18874b9d8750>)
scheme@(guix-user)> cache
$2 = "/home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq"
scheme@(guix-user)> ,q

$ repo=/home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq
$ git -C $repo log --oneline | head -n6
91e35e32a4 gnu: fcitx5-chinese-addons: Remove stale build steps.
2639a99cf3 gnu: fcitx5-lua: Remove stale build steps.
f769ad12f1 gnu: toybox: Cross compile.
8f330aebee gnu: busybox: Update to 1.32.0.
f765577dec gnu: Add emacs-webpaste.
72e3614666 gnu: emacs-elpher: Mention gemini in synopsis and description.
--8<---------------cut here---------------end--------------->8---

Well, ’commit-list’ is far from perfect because all the log is traversed
and the list reversed, aside that the first commit is not captured,
etc. But I hope you get the idea.  It is a starting point to implement a
draft of:

  guix git log --oneline


Cheers,
simon


  reply	other threads:[~2020-12-12 19:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 17:41 [outreachy] Walk through the Git history (guix git {authenticate, log}) zimoun
2020-12-11 19:01 ` [outreachy] Walk through the Git history (guix git {authenticate,log}) Magali
2020-12-12 12:24   ` zimoun [this message]
2020-12-12 17:24     ` Magali
2020-12-12 17:49       ` [outreachy] Walk through the Git history zimoun
2020-12-14 10:20         ` Ludovic Courtès
2020-12-15 15:20     ` [outreachy] Walk through the Git history (guix git {authenticate,log}) Magali
2020-12-16  9:35       ` zimoun
2020-12-18 15:34       ` Ludovic Courtès
2020-12-19  3:18         ` Magali
2020-12-12  8:42 ` Mathieu Othacehe
2020-12-12 12:10   ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86lfe3fc0t.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=boskovits@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=magalilemes00@gmail.com \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).