From patchwork Wed Jul 12 06:17:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 9835925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51215602A0 for ; Wed, 12 Jul 2017 06:17:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DF07265B9 for ; Wed, 12 Jul 2017 06:17:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 323EB285A0; Wed, 12 Jul 2017 06:17:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F0DD8265B9 for ; Wed, 12 Jul 2017 06:17:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA1316E353; Wed, 12 Jul 2017 06:17:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mblankhorst.nl (mblankhorst.nl [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C7A96E352; Wed, 12 Jul 2017 06:17:28 +0000 (UTC) From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH] dim: Add add-missing-cc command Date: Wed, 12 Jul 2017 08:17:21 +0200 Message-Id: <20170712061721.16164-1-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.11.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit will take the topmost commit and add all cc's from get_maintainer.pl, it is useful for adding cc's to an entire patch series touching multiple drivers, to add the right cc to each one. Signed-off-by: Maarten Lankhorst --- dim | 41 +++++++++++++++++++++++++++++++++++++++++ dim.rst | 6 ++++++ 2 files changed, 47 insertions(+) diff --git a/dim b/dim index 267dbc0313b1..2378ec56e438 100755 --- a/dim +++ b/dim @@ -1914,6 +1914,47 @@ function dim_fixes fi } +function dim_add_missing_cc +{ + git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do + email="$(echo "$cc" | sed -e 's/.*.*//')" + name='' + + if echo "$cc" | grep -q '<'; then + name="$(echo ${cc/<*/} | sed -e 's/[[:space:]]*\$//')"; + fi + + # Don't add main mailing lists + if [ "$email" = "dri-devel@lists.freedesktop.org" -o \ + "$email" = "linux-kernel@vger.kernel.org}" ]; then + continue + fi + + # Variables from the while loop don't propagate, + # print out a 1 on success + matches=$( + git show -s | grep -i "^ Cc:" | sed 's/^ *[Cc][Cc]: *//' | while read testcc; do + testemail="$(echo "$testcc" | sed -e 's/.*.*//')" + + if [ "$testemail" != "$email" ]; then + if [ -z "$name" ]; then continue; fi + + testname="$(echo ${testcc/<*/} | sed -e 's/[[:space:]]*\$//' -e 's/^[[:space:]]*//')" + + if [ "$testname" != "$name" ]; then continue; fi + fi + + echo 1 + break + done + ) + + if [ -z "$matches" ]; then + $DRY dim_commit_add_tag "Cc: ${cc}" + fi + done +} + function dim_help { manpage=$DIM_PREFIX/maintainer-tools/dim.rst diff --git a/dim.rst b/dim.rst index 10572f139130..ae511ca54cbe 100644 --- a/dim.rst +++ b/dim.rst @@ -274,6 +274,12 @@ add-link-queued **add-link** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +add-missing-cc +-------------- +Adds missing cc's to the topmost commit, can be used with +*git rebase --exec "dim add-missing-cc"* +to add cc's for an entire patch series. + magic-rebase-resolve -------------------- Tries to resolve a rebase conflict by first resetting the tree