From patchwork Tue Oct 11 09:52:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 43320 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2DED727BBEA; Tue, 11 Oct 2022 10:59:56 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 85A7D27BBE9 for ; Tue, 11 Oct 2022 10:59:55 +0100 (BST) Received: from localhost ([::1]:56958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiC3G-0004fI-L7 for patchwork@mira.cbaines.net; Tue, 11 Oct 2022 05:59:54 -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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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