From patchwork Mon Sep 12 13:55:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 42523 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 7923127BBEA; Mon, 12 Sep 2022 14:57:17 +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_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 9E15427BBE9 for ; Mon, 12 Sep 2022 14:57:16 +0100 (BST) Received: from localhost ([::1]:53730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXjw3-0000pn-PO for patchwork@mira.cbaines.net; Mon, 12 Sep 2022 09:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXjvr-0000mW-9y for guix-patches@gnu.org; Mon, 12 Sep 2022 09:57:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXjvq-0004QJ-W2 for guix-patches@gnu.org; Mon, 12 Sep 2022 09:57:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXjvq-0008Gs-SY for guix-patches@gnu.org; Mon, 12 Sep 2022 09:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support. References: <20220907151622.4912-1-othacehe@gnu.org> In-Reply-To: <20220907151622.4912-1-othacehe@gnu.org> Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Sep 2022 13:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57646 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57646@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 57646-submit@debbugs.gnu.org id=B57646.166299096431742 (code B ref 57646); Mon, 12 Sep 2022 13:57:02 +0000 Received: (at 57646) by debbugs.gnu.org; 12 Sep 2022 13:56:04 +0000 Received: from localhost ([127.0.0.1]:47472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXjut-0008Fk-Pi for submit@debbugs.gnu.org; Mon, 12 Sep 2022 09:56:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXjuq-00089G-SO for 57646@debbugs.gnu.org; Mon, 12 Sep 2022 09:56:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXjul-0004Lj-Ln for 57646@debbugs.gnu.org; Mon, 12 Sep 2022 09:55:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=HdQKlbdah978Indr12Gwbv2xGixALUyFyR/eeov7e4A=; b=gM+8PuLsJ9HcMa HPD5IEEsHFgumjRJsxOJBYzyvJza7bg3od0+NUb9DDGVaN+zhQ0It8AP/4wg95fogluNhned54XLe Fmpj4gFTdhJRbHsmyx1+fRwYHn4hCnm95cwWHBSF96ZjWII83CHeK1NhFonn9f/8CBbYh23w2+c5g uYMv/A8aspGY0whBW1hJbMpSEtJDKlXvKmE6mdPl/EFFT+49I0V1fzuZqDA3WHszZorpSCBhhRVS7 Ijg5a8bEWMksm8QwORSNJb+I2FuwWYdB3VuKU0khRUOjJg9s+UCLSjvnNOj1iFe4fvBPn1rJpw3HR bJ8h4hg7TBcOYYn+mx8A==; Received: from [2a02:587:1d33:7300:4fa4:945e:237e:7b1f] (port=42636 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXjul-0005y1-2T; Mon, 12 Sep 2022 09:55:55 -0400 From: Mathieu Othacehe Date: Mon, 12 Sep 2022 15:55:42 +0200 Message-Id: <20220912135545.24795-1-othacehe@gnu.org> X-Mailer: git-send-email 2.37.2 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 Add a scope list to each team. This list defines all the files and directories that are mentored by the team. Also add a cc-members command that takes two Git revision strings as input, add returns the members that should be CC'ed given the files impacted between the two revisions. * etc/teams.scm.in ()[scope]: New field. (team, list-teams): Adapt those procedures. (find-team-by-scope, diff-revisions): New procedures. (main): Add a "cc-members" command. * doc/contributing.texi ("Teams"): Document it. ("Sending a Patch Series"): Adapt it. --- doc/contributing.texi | 41 ++++++++++++++++++++++++ etc/teams.scm.in | 74 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 106 insertions(+), 9 deletions(-) diff --git a/doc/contributing.texi b/doc/contributing.texi index 17a54f94cc..7712f63d67 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -1406,6 +1406,47 @@ for more information. You can install @command{git send-email} with @command{guix install git:send-email}. @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html +To maximize the chances that you patch series is reviewed, the preferred +submission way is to use the @code{etc/teams.scm} script to notify the +appropriate team members (@pxref{Teams}). + +@unnumberedsubsec Teams +@anchor{Teams} +@cindex teams + +There are several teams mentoring different parts of the Guix source +code. To list all those teams, you can run from a Guix checkout: + +@example +$ ./etc/teams.scm list-teams +id: mentors +name: Mentors +description: A group of mentors who chaperone contributions by newcomers. +members: ++ Christopher Baines ++ Ricardo Wurmus ++ Mathieu Othacehe ++ jgart ++ Ludovic Courtès +@dots{} +@end example + +You can run the following command to have the @code{Mentors} team put in +CC of a patch series: + +@example +$ git send-email --to XXX@@debbugs.gnu.org $(./etc/teams.scm cc mentors) *.patch +@end example + +The appropriate team or teams can also be inferred from the modified +files. For instance, if you want to send the two latest commits of the +current Git repository to review, you can run: + +@example +$ guix shell -D guix +[env]$ git send-email --to XXX@@debbugs.gnu.org $(./etc/teams.scm cc-members HEAD~2 HEAD) *.patch +@end example + @node Tracking Bugs and Patches @section Tracking Bugs and Patches diff --git a/etc/teams.scm.in b/etc/teams.scm.in index 9f220cc489..22177422c2 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -4,6 +4,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ricardo Wurmus +;;; Copyright © 2022 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,23 +23,27 @@ ;;; Commentary: -;; This code defines development teams and team members. +;; This code defines development teams and team members, as well as their +;; scope. ;;; Code: (use-modules (srfi srfi-1) (srfi srfi-9) + (srfi srfi-26) (ice-9 format) (ice-9 match) - (guix ui)) + (guix ui) + (git)) (define-record-type - (make-team id name description members) + (make-team id name description members scope) team? (id team-id) (name team-name) (description team-description) - (members team-members set-team-members!)) + (members team-members set-team-members!) + (scope team-scope)) (define-record-type (make-person name email) @@ -49,11 +54,13 @@ (define-record-type (define* (person name #:optional email) (make-person name email)) -(define* (team id #:key name description (members '())) +(define* (team id #:key name description (members '()) + (scope '())) (make-team id (or name (symbol->string id)) description - members)) + members + scope)) (define %teams (make-hash-table)) @@ -272,6 +279,22 @@ (define (find-team name) (error (format #false "no such team: ~a~%" name)))) +(define (find-team-by-scope files) + "Return the team(s) which scope matches at least one of the FILES, as list +of file names as string." + (hash-fold + (lambda (key team acc) + (if (any (lambda (file) + (any (lambda (scope) + ;; XXX: Add regex support? + (string-prefix? scope file)) + (team-scope team))) + files) + (cons team acc) + acc)) + '() + %teams)) + (define (cc . teams) "Return arguments for `git send-email' to notify the members of the given TEAMS when a patch is received by Debbugs." @@ -293,7 +316,7 @@ (define port* (or port (current-output-port))) (team-members team))) (define (list-teams) - "Print all teams and their members." + "Print all teams, their scope and their members." (define port* (current-output-port)) (define width* (%text-width)) (hash-for-each @@ -303,7 +326,7 @@ (define width* (%text-width)) id: ~a name: ~a description: ~a -members: +~amembers: " (team-id team) (team-name team) @@ -312,15 +335,48 @@ (define width* (%text-width)) (string->recutils (fill-paragraph text width* (string-length "description: "))))) - "")) + "") + (match (team-scope team) + (() "") + (scope (format #f "scope: ~{~s ~}~%" scope)))) (list-members team port* "+ ") (newline)) %teams)) + +(define (diff-revisions rev-start rev-end) + "Return the list of added, modified or removed files between REV-START +and REV-END, two git revision strings." + (let* ((repository (repository-open (getcwd))) + (commit1 (commit-lookup repository + (object-id + (revparse-single repository rev-start)))) + (commit2 (commit-lookup repository + (object-id + (revparse-single repository rev-end)))) + (diff (diff-tree-to-tree repository + (commit-tree commit1) + (commit-tree commit2))) + (files '())) + (diff-foreach + diff + (lambda (delta progress) + (set! files + (cons (diff-file-path (diff-delta-old-file delta)) files)) + 0) + (const 0) + (const 0) + (const 0)) + files)) + + (define (main . args) (match args (("cc" . team-names) (apply cc (map find-team team-names))) + (("cc-members" rev-start rev-end) + (apply cc (find-team-by-scope + (diff-revisions rev-start rev-end)))) (("list-teams" . args) (list-teams)) (("list-members" . team-names)