From patchwork Mon Jun 15 21:03:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 22739 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 6E69127BBE3; Mon, 15 Jun 2020 22:42:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 24F4327BBE1 for ; Mon, 15 Jun 2020 22:42:06 +0100 (BST) Received: from localhost ([::1]:54956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkwrl-0002c3-KP for patchwork@mira.cbaines.net; Mon, 15 Jun 2020 17:42:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkwHv-0006az-2t for guix-patches@gnu.org; Mon, 15 Jun 2020 17:05:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jkwHu-0004I7-Ng for guix-patches@gnu.org; Mon, 15 Jun 2020 17:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jkwHu-0001WE-IZ for guix-patches@gnu.org; Mon, 15 Jun 2020 17:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41882] [PATCH] channels: Allow specifying per-channel --allow-downgrades in the channel file Resent-From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Jun 2020 21:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41882 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41882@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15922550525771 (code B ref -1); Mon, 15 Jun 2020 21:05:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jun 2020 21:04:12 +0000 Received: from localhost ([127.0.0.1]:47601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkwGy-0001Uu-SF for submit@debbugs.gnu.org; Mon, 15 Jun 2020 17:04:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:38998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkwGv-0001UX-Vz for submit@debbugs.gnu.org; Mon, 15 Jun 2020 17:04:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkwGr-0005og-HL for guix-patches@gnu.org; Mon, 15 Jun 2020 17:04:01 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:50398) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkwGo-0004D4-MG for guix-patches@gnu.org; Mon, 15 Jun 2020 17:03:57 -0400 Received: (qmail 13757 invoked by uid 1009); 15 Jun 2020 23:03:51 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25843. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.044095 secs); 15 Jun 2020 21:03:51 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 15 Jun 2020 23:03:51 +0200 From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Date: Mon, 15 Jun 2020 23:03:43 +0200 Message-Id: <20200615210343.18964-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Received-SPF: none client-ip=37.59.186.212; envelope-from=kuba@kadziolka.net; helo=pat.zlotemysli.pl X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/15 17:03:52 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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" X-getmail-retrieved-from-mailbox: Patches * guix/channels.scm () [allow-unrelated?, allow-downgrade?]: New fields. (ensure-forward-channel-update): Handle the fields appropriately. --- guix/channels.scm | 5 +++++ 1 file changed, 5 insertions(+) Some time ago, guix pull started verifying that the new commit follows the old commit in the git history. That's good in the common case, but unfortunately, this broke my workflow [0]. Namely, I maintain a branch of the guix repository on which I cherry-pick some commits that haven't hit master yet. I rebase it onto master frequently. It gets tiring to have to specify --allow-downgrades when pulling, so I added a way of specifying it in the channels file. As a bonus, it's more granular. If this is the right approach, I'll add some docs. Also, is there a test that exercises this function? [0]: https://xkcd.com/1172/ diff --git a/guix/channels.scm b/guix/channels.scm index 84c47fc0d0..17c4f3750c 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -104,6 +105,8 @@ (url channel-url) (branch channel-branch (default "master")) (commit channel-commit (default #f)) + (allow-unrelated? channel-allow-unrelated? (default #f)) + (allow-downgrade? channel-allow-downgrade? (default #f)) (location channel-location (default (current-source-location)) (innate))) @@ -245,6 +248,8 @@ This procedure implements a channel update policy meant to be used as a (match relation ('ancestor #t) ('self #t) + ((? (const (channel-allow-unrelated? channel)) 'unrelated) #t) + ((? (const (channel-allow-downgrade? channel)) 'descendant) #t) (_ (raise (make-compound-condition (condition