From patchwork Tue Dec 27 15:32:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 45600 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 3FA2527BBED; Tue, 27 Dec 2022 15:34:44 +0000 (GMT) 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=ham 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 3B6F827BBEB for ; Tue, 27 Dec 2022 15:34:43 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pABxx-0004jF-0s; Tue, 27 Dec 2022 10:34:09 -0500 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 1pABxq-0004hi-T9 for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pABxq-0003xG-B7 for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pABxq-0004ni-76 for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60218] [PATCH v2 2/3] teams: Allow a patch-file argument to cc-members. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 27 Dec 2022 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60218 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60218@debbugs.gnu.org Cc: rekado@elephly.net, othacehe@gnu.org, Maxim Cournoyer Received: via spool by 60218-submit@debbugs.gnu.org id=B60218.167215519218369 (code B ref 60218); Tue, 27 Dec 2022 15:34:02 +0000 Received: (at 60218) by debbugs.gnu.org; 27 Dec 2022 15:33:12 +0000 Received: from localhost ([127.0.0.1]:56325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pABx1-0004mD-Jz for submit@debbugs.gnu.org; Tue, 27 Dec 2022 10:33:12 -0500 Received: from mail-yw1-f181.google.com ([209.85.128.181]:38516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pABwz-0004lm-W5 for 60218@debbugs.gnu.org; Tue, 27 Dec 2022 10:33:10 -0500 Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-43ea87d0797so188193777b3.5 for <60218@debbugs.gnu.org>; Tue, 27 Dec 2022 07:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=vhub/hLekYxvyb67s2Cy4GEUHPeUb02MaNQEko9gUWM=; b=g+5RgQwVeAo+aahr1mfHhJp9FikmM6zwFoVe9FEwadr/97POjmj3mkKMjK0lPqvMAM Uenpy7f+SigBu7yvhIH5iBvSYjXv1DoFON3FFtCHjzbcGr/FSegG8237kOI+AmwMuaFi tHKTA8AA4PvexX/j7g416Pv8yiyaUVrIZVizkfpTnLrWlK3nKpGuu03+F+CsjoOYiJrn Pyq2LTPt38XKOStkyTBVEMGO6C0eUz4n3NJNErgUcLQNBlipo8Hs1Dof+OxkBj9WjMcj JuRUQEMiy7H9k63ExRHAclWSPHySv7BUYxJ3iBnpkO4dv2nytbC81oFJcX0aaaKVdEVE 7nvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vhub/hLekYxvyb67s2Cy4GEUHPeUb02MaNQEko9gUWM=; b=JJBhbRGcEh8LCo5HBu9jxCwtKN+n8kRgL1XpMAcN7FJidhJvkRR5w7Fh8ctUccxC/H RgP+VoW8SGn9QQ+iQEcZAJfrGCmxzGezUACFkxTBbDYjS2KANy01XuvDANVGtrtMqtrv 7sScReKIVg2fRnds3n1Hb9Cd+DUv+DmmPzX0KKxFM1/ObQg5SmIvJEQL0tHIB3X2IoTL OUA35jHZNVjo+nZOOpdojZxDV2HQJbiX0QLSVwAMtNAXvF6JaAfYAbtFZhusQwfDnl0R 73ZkhyWLjR+/0JiUAg+Z++io/QCJYk5mSZosiEWpNNyGpTxLasCBr5Jgvgu25daxZvh3 HvGA== X-Gm-Message-State: AFqh2krW80qSJvRkVmOCYNLFxzSMkbWKebq4APh9e5XkSrCt6K1O3SCk yHvo959p9qNGvn57I7NPWS9qNS/wzJ/QRA== X-Google-Smtp-Source: AMrXdXtKq6EY/rPU+Kq2E90xBgzGyMp1pcimNnKXyWh5fZB35EigVQAaS6zViL5t2VQ4LH14OKe/DQ== X-Received: by 2002:a05:7500:2486:b0:ec:9852:28c8 with SMTP id ba6-20020a057500248600b000ec985228c8mr1261500gab.74.1672155184239; Tue, 27 Dec 2022 07:33:04 -0800 (PST) Received: from localhost.localdomain (dsl-10-129-132.b2b2c.ca. [72.10.129.132]) by smtp.gmail.com with ESMTPSA id bp13-20020a05620a458d00b006fefa5f7fc9sm9505322qkb.134.2022.12.27.07.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 07:33:03 -0800 (PST) From: Maxim Cournoyer Date: Tue, 27 Dec 2022 10:32:47 -0500 Message-Id: <20221227153249.16793-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221227153249.16793-1-maxim.cournoyer@gmail.com> References: <20221227153249.16793-1-maxim.cournoyer@gmail.com> 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 * etc/teams.scm.in (git-patch->revisions): New procedure. (main) [cc-members]: New match pattern to support patch file argument. [get-maintainer]: Simplify using the newly introduced procedure from above. (main): Update usage doc. --- Changes in v2: - New: support passing a patch file to the cc-members command etc/teams.scm.in | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index e50efea786..96a04aca3d 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -634,20 +634,29 @@ (define (git-patch->commit-id file) (error "invalid patch file:" file)) (match:substring m 1))))) +(define (git-patch->revisions file) + "Return the start and end revisions of FILE, a patch file produced with git." + (let* ((rev-end (git-patch->commit-id file)) + (rev-start (string-append rev-end "^"))) + (list rev-start rev-end))) + (define (main . args) (match args (("cc" . team-names) (apply cc (map find-team team-names))) + (("cc-members" patch-file) + (unless (file-exists? patch-file) + (error "patch file does not exist:" patch-file)) + (apply main "cc-members" (git-patch->revisions patch-file))) (("cc-members" rev-start rev-end) (apply cc (find-team-by-scope (diff-revisions rev-start rev-end)))) (("get-maintainer" patch-file) - (let* ((rev-end (git-patch->commit-id patch-file)) - (rev-start (string-append rev-end "^"))) - (apply main "list-members" - (map (compose symbol->string team-id) - (find-team-by-scope (diff-revisions rev-start rev-end)))))) + (apply main "list-members" + (map (compose symbol->string team-id) + (find-team-by-scope (apply diff-revisions + (git-patch->revisions patch-file)))))) (("list-teams" . args) (list-teams)) (("list-members" . team-names) @@ -660,10 +669,15 @@ (define (main . args) "Usage: etc/teams.scm [] Commands: - cc get git send-email flags for cc-ing - cc-members cc teams related to files changed between revisions - list-teams list teams and their members - list-members list members belonging to - get-maintainer compatibility mode with Linux get_maintainer.pl~%")))) + cc + get git send-email flags for cc-ing + cc-members | patch + cc teams related to files changed between revisions or in a patch file + list-teams + list teams and their members + list-members + list members belonging to + get-maintainer + compatibility mode with Linux get_maintainer.pl~%")))) (apply main (cdr (command-line)))