From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp2 ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms11 with LMTPS
	id okbdMzHr514dewAA0tVLHw
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 15 Jun 2020 21:42:09 +0000
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp2 with LMTPS
	id mCWfLzHr517SDwAAB5/wlQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 15 Jun 2020 21:42:09 +0000
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 3CCA694030A
	for <larch@yhetil.org>; Mon, 15 Jun 2020 21:42:09 +0000 (UTC)
Received: from localhost ([::1]:54956 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	id 1jkwrm-0002c3-RM
	for larch@yhetil.org; Mon, 15 Jun 2020 17:42:06 -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 <Debian-debbugs@debbugs.gnu.org>)
 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 <Debian-debbugs@debbugs.gnu.org>)
 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 <Debian-debbugs@debbugs.gnu.org>) 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?Q?K=C4=85dzio=C5=82ka?= <kuba@kadziolka.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Mon, 15 Jun 2020 21:05:02 +0000
Resent-Message-ID: <handler.41882.B.15922550525771@debbugs.gnu.org>
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 <debbugs-submit-bounces@debbugs.gnu.org>)
 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 <kuba@kadziolka.net>) 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 <kuba@kadziolka.net>)
 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 <kuba@kadziolka.net>) 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 <kuba@kadziolka.net>,
 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?Q?K=C4=85dzio=C5=82ka?= <kuba@kadziolka.net>
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
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-Spam-Score: -3.3 (---)
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+larch=yhetil.org@gnu.org>
X-Scanner: scn0
Authentication-Results: aspmx1.migadu.com;
	dkim=none;
	dmarc=none;
	spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org
X-Spam-Score: -0.01
X-TUID: oVnt7igbQbHX

* guix/channels.scm (<channel>)
  [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 <ludo@gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; 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
-- 
2.26.2