From patchwork Sat Jun 12 11:57:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 30183 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 F0FD927BC81; Sat, 12 Jun 2021 12:58:32 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,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 ESMTPS id B757C27BC78 for ; Sat, 12 Jun 2021 12:58:32 +0100 (BST) Received: from localhost ([::1]:55436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls2HX-0006Cd-RN for patchwork@mira.cbaines.net; Sat, 12 Jun 2021 07:58:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls2H4-0006CK-5w for guix-patches@gnu.org; Sat, 12 Jun 2021 07:58:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57139) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ls2H3-0006m4-Po for guix-patches@gnu.org; Sat, 12 Jun 2021 07:58:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ls2H3-000439-QJ for guix-patches@gnu.org; Sat, 12 Jun 2021 07:58:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48971] [PATCH 1/2] swh: Support lookup of Hg tags. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 12 Jun 2021 11:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48971 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48971@debbugs.gnu.org Received: via spool by 48971-submit@debbugs.gnu.org id=B48971.162349904915513 (code B ref 48971); Sat, 12 Jun 2021 11:58:01 +0000 Received: (at 48971) by debbugs.gnu.org; 12 Jun 2021 11:57:29 +0000 Received: from localhost ([127.0.0.1]:40450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ls2GW-000429-TV for submit@debbugs.gnu.org; Sat, 12 Jun 2021 07:57:29 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:35578 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ls2GU-00041p-Ov for 48971@debbugs.gnu.org; Sat, 12 Jun 2021 07:57:27 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1623499040; bh=j9TwaveoX7r8U5DkeF2faZc327V+HOSv9Ev4TGbnfpk=; h=From:To:Subject:In-Reply-To:References:Date; b=d+iCYfPTHNvg1XuZbVJc9L+oHj8EEIsRksqA/Mb+GVKUmQaixBgngC3eFzJC+y12I +gke0Bnke3Igd7WWFnJCEw50cDeGIarPJ3OSVKNGDzFwkkdeoI97IYpMm1vWVwngqk fZ4Np2n3rTiKT4R4ctgIx4vX2TfD0KKFicSroigo= In-Reply-To: References: Message-Id: Date: Sat, 12 Jun 2021 13:57:19 +0200 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 * guix/swh.scm (lookup-origin-revision): Support lookup of Hg tags, not just Git tags. --- I noticed that the ‘commit-id?’ procedure checks if REFERENCE is of length 40, this will result in false negatives because some packages that use ‘hg-fetch’ only specify the first ~10 or ~15 characters of the changeset revision. We should probably fix that. guix/swh.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/guix/swh.scm b/guix/swh.scm index f6d5241e06..b5c800011d 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2020 Jakub Kądziołka +;;; Copyright © 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -455,8 +456,13 @@ URL could not be found." ((visit . _) (let ((snapshot (visit-snapshot visit))) (match (and=> (find (lambda (branch) - (string=? (string-append "refs/tags/" tag) - (branch-name branch))) + (or + ;; Git specific. + (string=? (string-append "refs/tags/" tag) + (branch-name branch)) + ;; Hg specific. + (string=? tag + (branch-name branch)))) (snapshot-branches snapshot)) branch-target) ((? release? release)