From patchwork Tue Aug 15 19:44:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 52853 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 53C2727BBEC; Tue, 15 Aug 2023 20:46:29 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS 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 3C00E27BBE9 for ; Tue, 15 Aug 2023 20:46:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVzzT-0002Qr-Pv; Tue, 15 Aug 2023 15:46:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVzzR-0002Q0-2j for guix-patches@gnu.org; Tue, 15 Aug 2023 15:46:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVzzQ-0007X0-Pz; Tue, 15 Aug 2023 15:46:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVzzN-0001mC-Jt; Tue, 15 Aug 2023 15:46:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64746] [PATCH v2 1/3] git: Clarify commit relation reference in doc. References: In-Reply-To: Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 15 Aug 2023 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64746 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64746@debbugs.gnu.org Cc: Maxim Cournoyer , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64746-submit@debbugs.gnu.org id=B64746.16921287126749 (code B ref 64746); Tue, 15 Aug 2023 19:46:01 +0000 Received: (at 64746) by debbugs.gnu.org; 15 Aug 2023 19:45:12 +0000 Received: from localhost ([127.0.0.1]:36661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVzya-0001kn-BK for submit@debbugs.gnu.org; Tue, 15 Aug 2023 15:45:12 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:51224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVzyW-0001k3-Gf for 64746@debbugs.gnu.org; Tue, 15 Aug 2023 15:45:11 -0400 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-40ff796e8ddso43112441cf.2 for <64746@debbugs.gnu.org>; Tue, 15 Aug 2023 12:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692128702; x=1692733502; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3QneMBPT8ky8lkuiPx8LP9V5ElnnO08mtoiDJKnEmD0=; b=fAUHj9hdVXt41KNA1UBVY1AloV6uhaS0UMPgbIEHRaO4JubOEUlCIDsS618Bw80mHi 00yTEaZHB307t5+YpHb6ZrliV23/nqy9kFwlWfpLkTJJ2rtVOtEQJSq1UBWmvAzBOsix G/IR/9prCsl9NswhKJ5k5gRXJBmqVWdAj7fEIUxAi33vgDHuD0h53IjbLot//kM1TDSw 3aNtGiQayft8GK9FHMgXybU+Dla88ENIaXk2ANc6iYwh7vOveCVU9pQl2Pk3PnRPGxuE pDiWjIGv7j3+jzM4BXJldURsfpcKaz6XNzN6IGUDjgmKc5+T6CtrFu25q0DTLNBZArs2 lHLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692128702; x=1692733502; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3QneMBPT8ky8lkuiPx8LP9V5ElnnO08mtoiDJKnEmD0=; b=Tj4LZbejAlW088J8eTwXRByL9DbKa0O2XrBfMmUE+5CRb4nKL4Z9OimD+tvQIZl2fX 0Xj2WN4V1/ZDAQ9WEHUqO26D+7lW45QBjuAoSFFSk1Zix2BpUvn68kfegdVev/3r9OlW l6B+Yk6NtY4oe1r6mTkVocgwpU4YPaTF6urOb6LMYpZZ9pCB38Qx7oHIWRCQYpW89kaF wwUZfIZjexvUJtXnXY0oROCCPPH5uBAdZCrrhU3tr6C6RW+X3212mD+nePgirC30vrVB G4C3Xj01enjRrxOcQer9gJNAYLTVcuQFPUPMKofplZme5wRAmAmy15yOFSwl2dEfBLtq 89UA== X-Gm-Message-State: AOJu0Yx7aBfOCVFY0HYkz3bodwmXIiBj5rSRR3nvQdWYucSP/0pF5DfX rXinbwsyuTFsnOYnuuCEji3tBInD7ecttA== X-Google-Smtp-Source: AGHT+IHoczIZ9BjjZExGDp8wO2h30hC4jWdZY/qvIqBE6JW9BCyUeeV8eDav/kqeYknEm0PoIlke9g== X-Received: by 2002:a05:622a:1981:b0:40c:3f64:b55f with SMTP id u1-20020a05622a198100b0040c3f64b55fmr17811569qtc.15.1692128702353; Tue, 15 Aug 2023 12:45:02 -0700 (PDT) Received: from localhost.localdomain (dsl-148-65.b2b2c.ca. [66.158.148.65]) by smtp.gmail.com with ESMTPSA id h11-20020ac8744b000000b00403ad6ec2e8sm3953031qtr.26.2023.08.15.12.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 12:45:01 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 15 Aug 2023 15:44:07 -0400 Message-ID: <340786ccd3d40c0c8906028dc20af5ae9b0aa6b9.1692128648.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/git.scm (update-cached-checkout): Clarify that it is the relation of STARTING-COMMIT that is returned, relative to the new commit, not the other way around. --- (no changes since v1) guix/git.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: a4bed14c438dc0cbc1c1885a38f8409c7fef7957 diff --git a/guix/git.scm b/guix/git.scm index be20cde019..dbc3b7caa7 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -439,7 +439,7 @@ (define* (update-cached-checkout url #:recursive? recursive?))) "Update the cached checkout of URL to REF in CACHE-DIRECTORY. Return three values: the cache directory name, and the SHA1 commit (a string) corresponding -to REF, and the relation of the new commit relative to STARTING-COMMIT (if +to REF, and the relation of STARTING-COMMIT relative to the new commit (if provided) as returned by 'commit-relation'. REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value From patchwork Thu Jul 20 16:34:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 51863 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 591C727BBE9; Thu, 20 Jul 2023 17:35:27 +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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,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 AC26427BBE2 for ; Thu, 20 Jul 2023 17:35:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMWcT-0006pi-Qt; Thu, 20 Jul 2023 12:35:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMWcP-0006nt-1C for guix-patches@gnu.org; Thu, 20 Jul 2023 12:35:10 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMWcO-000776-97; Thu, 20 Jul 2023 12:35:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMWcI-0007Ji-1a; Thu, 20 Jul 2023 12:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64746] [PATCH 2/2] scripts: time-machine: Error when attempting to visit too old commits. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 20 Jul 2023 16:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64746 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64746@debbugs.gnu.org, maxim.cournoyer@gmail.com Cc: Simon Tournier , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org, maxim.cournoyer@gmail.com X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.168987085828058 (code B ref -1); Thu, 20 Jul 2023 16:35:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2023 16:34:18 +0000 Received: from localhost ([127.0.0.1]:59634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMWba-0007IT-Bi for submit@debbugs.gnu.org; Thu, 20 Jul 2023 12:34:18 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMWbX-0007I8-Kv for submit@debbugs.gnu.org; Thu, 20 Jul 2023 12:34:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMWbS-0006KA-2U for guix-patches@gnu.org; Thu, 20 Jul 2023 12:34:10 -0400 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMWbP-0006lX-V5 for guix-patches@gnu.org; Thu, 20 Jul 2023 12:34:09 -0400 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-4039a2b71c1so8120951cf.0 for ; Thu, 20 Jul 2023 09:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689870846; x=1690475646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=045dGLNHIPQhzDZ2hgQBBy4cIPRrb+GTPYAsubP80dE=; b=GPYkpFFgwQ+WqAjOua0dMZhrPk9NSeVoWqWsPsKSI0Tx8RPRdulEZmhsvkbqDmwj3L AidSDmDWIg/Dx7Mv8uDtIyvF/teVJZesZZx3rmgGij1c8jBnH5LRlQBZHwoq56upVf8W mQ2H0GodNjPI1q27At3IJ9Rk/c+tEKgNsAulpdga9DgEtbKS37FrwqGa76WFILKUJcuW h3am+z014jJeAHhux6t4HpRAoAF66TqoYbFUNkIsq2dAL8P6L1Jsi9KNQQtjxfXAWRmk K4HGHUF6sV5o+6rP2CYbeurp69zlFmHupBuw/2qMRsf2VTLXI4qoXHjKKr5wPTs1IpI1 U8lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689870846; x=1690475646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=045dGLNHIPQhzDZ2hgQBBy4cIPRrb+GTPYAsubP80dE=; b=QENp7BsgoeiyDG8O1eG+/gCmB8N34kugHWreSVeZjW6TcT49CcyLxLQryyT7bBNyyh hyoIqQK6rjbWSlvhHbZ0TlBuXmF3SK/rkNx0FIr37dWg18g/jyGPZBsbH/ELN/xlUUdO HcLEok/X3rlhtM4MHQLWvsfWsvn8twlJjOvkizAzIq87ZsoVx2nXiru35xgNF5S+btBS PnAaZkjmgqdsGRvRpfUsjCD4UJx6vIy3mTmq6icMEHV6tCOtFs0aWwmTIrKj4gR7qcry FOW4FouQqGOJUpsYaavb5tNMvT6DFmdqsiJe0eNT7W0L2Fnw2ATvIk4C+NXVjp8JlFVn /tfA== X-Gm-Message-State: ABy/qLYlvdHFdPn9saJe5T5LW9f/xRMEAuJhramhuutuqsaaGs//hco+ 5PMTE3Zw2OWmFwr1xjKQOSNaBWw2Xek= X-Google-Smtp-Source: APBJJlH0pXITnxf/op/3+JE3lKNDWzUBJKgkEVyUutKUo/oXXuGgi5mhmqsW5jyNpKTTOqO52hjCxA== X-Received: by 2002:ac8:5992:0:b0:405:4673:58e0 with SMTP id e18-20020ac85992000000b00405467358e0mr1378729qte.63.1689870846507; Thu, 20 Jul 2023 09:34:06 -0700 (PDT) Received: from localhost.localdomain (dsl-159-145.b2b2c.ca. [66.158.159.145]) by smtp.gmail.com with ESMTPSA id j7-20020ac84c87000000b00401e04c66fesm510860qtv.37.2023.07.20.09.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 09:34:06 -0700 (PDT) From: Maxim Cournoyer Date: Thu, 20 Jul 2023 12:34:01 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::830; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x830.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Invoking guix time-machine): Document limitation. * guix/scripts/time-machine.scm (%oldest-possible-commit): New variable. (guix-time-machine): Raise an error when the channel commit is too old. Suggested-by: Simon Tournier --- doc/guix.texi | 6 ++++++ guix/scripts/time-machine.scm | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1d8ebcd72f..30fef813c0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5056,6 +5056,12 @@ Invoking guix time-machine large number of packages; the result is cached though and subsequent commands targeting the same commit are almost instantaneous. +Due to @command{guix time-machine} relying on the ``inferiors'' +mechanism (@pxref{Inferiors}), the oldest commit it can travel to is +commit @samp{2ca299caf} (``Add (guix inferior) and (guix scripts +repl).''), dated July 10@sup{th}, 2018. An error is returned when +attempting to navigate to older commits. + @quotation Note The history of Guix is immutable and @command{guix time-machine} provides the exact same software as they are in a specific Guix diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm index d7c71ef705..36a40a1538 100644 --- a/guix/scripts/time-machine.scm +++ b/guix/scripts/time-machine.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2019 Konrad Hinsen ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2023 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,13 +20,15 @@ ;;; along with GNU Guix. If not, see . (define-module (guix scripts time-machine) + #:use-module (guix channels) + #:use-module (guix diagnostics) #:use-module (guix ui) #:use-module (guix scripts) #:use-module (guix inferior) #:use-module (guix store) #:use-module (guix status) #:use-module ((guix git) - #:select (with-git-error-handling)) + #:select (update-cached-checkout with-git-error-handling)) #:use-module ((guix utils) #:select (%current-system)) #:use-module ((guix scripts pull) @@ -38,9 +41,16 @@ (define-module (guix scripts time-machine) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-34) #:use-module (srfi srfi-37) + #:use-module (srfi srfi-71) #:export (guix-time-machine)) +;;; The commit introducing the 'inferiors' mechanism; it is the oldest commit +;;; that can be travelled to. +(define %oldest-possible-commit + "2ca299caf64489f4e1e665ec1158fb0309b0b565") + ;;; ;;; Command-line options. @@ -139,9 +149,20 @@ (define-command (guix-time-machine . args) (with-git-error-handling (let* ((opts (parse-args args)) (channels (channel-list opts)) + (guix-channel (find guix-channel? channels)) (command-line (assoc-ref opts 'exec)) + (ref (assoc-ref opts 'ref)) + (checkout commit relation (update-cached-checkout + (channel-url guix-channel) + #:ref (or ref '()) + #:starting-commit + %oldest-possible-commit)) (substitutes? (assoc-ref opts 'substitutes?)) (authenticate? (assoc-ref opts 'authenticate-channels?))) + (unless (memq relation '(ancestor self)) + (raise (formatted-message + (G_ "cannot travel past commit `~a' from July 10th, 2018") + (string-take %oldest-possible-commit 12)))) (when command-line (let* ((directory (with-store store