From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yFfMGJ0+RWMHfQAAbAwnHQ (envelope-from ) for ; Tue, 11 Oct 2022 11:59:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wMnVGJ0+RWO3YQAAauVa8A (envelope-from ) for ; Tue, 11 Oct 2022 11:59:57 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1FCC93A68F for ; Tue, 11 Oct 2022 11:59:57 +0200 (CEST) Received: from localhost ([::1]:56958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiC3I-0004fI-0B for larch@yhetil.org; Tue, 11 Oct 2022 05:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiBwd-0000EJ-HW for guix-patches@gnu.org; Tue, 11 Oct 2022 05:53:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiBwc-0004Pt-TD for guix-patches@gnu.org; Tue, 11 Oct 2022 05:53:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiBwc-0003BD-O7 for guix-patches@gnu.org; Tue, 11 Oct 2022 05:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58433] [PATCH 2/2] channels: Interpret the 'commit' field of channel as a tag or commit. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 11 Oct 2022 09:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58433 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58433@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 58433-submit@debbugs.gnu.org id=B58433.166548196612193 (code B ref 58433); Tue, 11 Oct 2022 09:53:02 +0000 Received: (at 58433) by debbugs.gnu.org; 11 Oct 2022 09:52:46 +0000 Received: from localhost ([127.0.0.1]:50940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiBwM-0003AW-8y for submit@debbugs.gnu.org; Tue, 11 Oct 2022 05:52:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiBwK-0003AC-C0 for 58433@debbugs.gnu.org; Tue, 11 Oct 2022 05:52:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiBwF-0004ON-51; Tue, 11 Oct 2022 05:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ZZbrTrrqxE9FfAdnfglO9jifxPLtvHu2KwAaEtRq9sI=; b=DkGFbF+BkHgMfGfEVHzC 2+glWjpLKP3CeaPP84H7RIpFVqtPEY4afoPJQfqUPEdbO2xpKtSYvRVGzrbydHwJd+OY/1TZ6QISJ 6q4WPTseH+zFHRpkCJWL6m9GHUKH5Yu24u9F9owwJJeKDLjtbT4/hFXqStgvnOqk6sOkaYxSXKY/K zFvw0xj6gn0O2Ow5cGcFoqqggSgjRQ+oYmT52POMoD/WADaEXa8sgu15vI/rCGvKR7ns0TSDgz/1+ pGw81zGcJMiif3Ucyk1eCmeoYnDFT/u/NQbhwpRXaBHtpWL9ftOzpgrCzvei1Y10vwXR33EpKMtmF p2DwzLiZ5ZEmCQ==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59686 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiBwE-0002Tv-O0; Tue, 11 Oct 2022 05:52:38 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 11 Oct 2022 11:52:29 +0200 Message-Id: <20221011095229.31244-2-ludo@gnu.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221011095229.31244-1-ludo@gnu.org> References: <20221011095229.31244-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665482397; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ZZbrTrrqxE9FfAdnfglO9jifxPLtvHu2KwAaEtRq9sI=; b=Jyg2pKtmTZWQHb1+9f4wnixeRMfLRTMk5MJXR4YEJE8uc/LQQFBQqzC4+H9b9U7lo0HIna 27Q17WYj2RGnti8iHPFOOL95jHC699KymWWm3OaHHaaqvMv+dCMpd1v2EOLU5rd4N+8bth 8rIFiWppptRBO9vrJV+auLbkj9ZWqUompZPsB/fQqCsTxoEjh2LXlH3RsNUlf7/yhF0rZU /EXA94NvcdF+MC0YDd2BXh3JHfTizbHTTZflUMvJ6I0YCmMrGQzE41GSFYHMg68/HSt8mM CrZrS1iFJ1ygw8QXROLJZWKJ2UaAsnFQKgUn93h6vuQDU7nJda7VI4Jnx6WFkw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665482397; a=rsa-sha256; cv=none; b=q7ClG/USZ6POYkmE6O7yLJlESyNmm9cskpCxGtvTWvZ542MkfQZOV1lrkYrM+Tnx1dpFua RXO+IExFwlrTO1dHkr2M6L2u4INEC4gwOy+tiqMZ3PJPMytuTOiGYwnujfB1hrdh+tECC0 CAoD3dJJ5EGsv7VvutiBlQOuZezROwVrFmT/WfichKuGYPTiSvNZ9vjwnZRX9/7fBB3Cqm RNE8fFjPe50yiO8ERjXIVbtoKiPqyFyR34N3dDCmz6EwrKtXuLdWJ4pUzWFD2stEgpRSII f15pmSj5XHcOrtIJad5Diok2NPqBHgB6e4tFXTOakiTKPY0dIR0JwyWtbrNoBg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DkGFbF+B; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.40 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DkGFbF+B; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1FCC93A68F X-Spam-Score: -1.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: ug+U5FawKIkE Previously the 'commit' field would always be interpreted as a commit ID. This change adds flexibility, allowing for things like: guix time-machine --commit=v1.2.0 -- describe * guix/channels.scm (channel-reference): Use 'tag-or-commit' rather than 'commit'. * guix/inferior.scm (channel-full-commit): Likewise. * doc/guix.texi (Invoking guix pull): Document it. (Invoking guix time-machine): Likewise. --- doc/guix.texi | 23 +++++++++++++++++++++-- guix/channels.scm | 2 +- guix/inferior.scm | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 14592142dd..4c24600f04 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4631,7 +4631,7 @@ but it supports the following options: @itemx --branch=@var{branch} Download code for the @code{guix} channel from the specified @var{url}, at the given @var{commit} (a valid Git commit ID represented as a hexadecimal -string), or @var{branch}. +string or the name of a tag), or @var{branch}. @cindex @file{channels.scm}, configuration file @cindex configuration file for channels @@ -4783,6 +4783,25 @@ of Guix to be used is defined by a commit or by a channel description file created by @command{guix describe} (@pxref{Invoking guix describe}). +Let's assume that you want to travel to those days of November 2020 when +version 1.2.0 of Guix was released and, once you're there, run the +@command{guile} of that time: + +@example +guix time-machine --commit=v1.2.0 -- \ + environment -C --ad-hoc guile -- guile +@end example + +The command above fetches Guix@tie{}1.2.0 and runs its @command{guix +environment} command to spawn an environment in a container running +@command{guile} (@command{guix environment} has since been subsumed by +@command{guix shell}; @pxref{Invoking guix shell}). It's like driving a +DeLorean@footnote{If you don't know what a DeLorean is, consider +traveling back to the 1980's.}! The first @command{guix time-machine} +invocation can be expensive: it may have to download or even build a +large number of packages; the result is cached though and subsequent +commands targeting the same commit are almost instantaneous. + The general syntax is: @example @@ -4799,7 +4818,7 @@ this revision are the same as for @command{guix pull} (@pxref{Invoking guix pull @itemx --branch=@var{branch} Use the @code{guix} channel from the specified @var{url}, at the given @var{commit} (a valid Git commit ID represented as a hexadecimal -string), or @var{branch}. +string or the name of a tag), or @var{branch}. @item --channels=@var{file} @itemx -C @var{file} diff --git a/guix/channels.scm b/guix/channels.scm index f1c23c17fb..d84228c47e 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -248,7 +248,7 @@ (define (channel-reference channel) 'latest-repository-commit'." (match (channel-commit channel) (#f `(branch . ,(channel-branch channel))) - (commit `(commit . ,(channel-commit channel))))) + (commit `(tag-or-commit . ,(channel-commit channel))))) (define sexp->channel-introduction (match-lambda diff --git a/guix/inferior.scm b/guix/inferior.scm index cbb3c0a36e..2fe34ca0dc 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -835,7 +835,7 @@ (define (channel-full-commit channel) (branch (channel-branch channel))) (if (and commit (commit-id? commit)) commit - (let* ((ref (if commit `(commit . ,commit) `(branch . ,branch))) + (let* ((ref (if commit `(tag-or-commit . ,commit) `(branch . ,branch))) (cache commit relation (update-cached-checkout (channel-url channel) #:ref ref -- 2.38.0