You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2023/11/21 00:21:47 UTC

(calcite) 04/04: [CALCITE-6125] Automate generation of contributor names in release notes by adding a git mailmap file

This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 343132ecc98779e55fbaf5c75d3d9e349dd6a8c7
Author: Julian Hyde <jh...@apache.org>
AuthorDate: Fri Nov 17 11:00:12 2023 -0800

    [CALCITE-6125] Automate generation of contributor names in release notes by adding a git mailmap file
    
    Add entries to .mailmap to that release notes since 1.29
    would be generated correctly.
    
    Update HOWTO examples showing how to generate release notes.
    
    Add a lint test to ensure that .mailmap remains sorted.
    
    Close apache/calcite#3533
---
 .mailmap                                           | 148 +++++++++++++++++++++
 .../java/org/apache/calcite/test/LintTest.java     |  34 +++++
 .../java/org/apache/calcite/util/TestUnsafe.java   |   3 +-
 site/_docs/howto.md                                |  13 +-
 4 files changed, 191 insertions(+), 7 deletions(-)

diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000000..82ec920401
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,148 @@
+# Git mail map; see 'git help mailmap' for details.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+Abhishek Dasgupta <ab...@gmail.com>
+Adam Kennedy <ad...@gmail.com>
+Alan Jin <ji...@gmail.com>
+Ali Mansour <Al...@murex.com>
+Amir Gajst <am...@sisense.com>
+Botong Huang <bo...@alibaba-inc.com>
+Cancai Cai <77...@users.noreply.github.com>
+Charbel Yazbeck <cy...@murex.com>
+Chen Kai <ch...@gmail.com>
+Chunhui Shi <cs...@maprtech.com>
+Chunwei Lei <ch...@alibaba-inc.com>
+Chunwei Lei <ch...@gmail.com>
+Chunwei Lei <ch...@163.com>
+Daniel Henneberger <gi...@danielhenneberger.com>
+Daniel Henneberger <me...@danielhenneberger.com>
+Danny Chan <yu...@alibaba-inc.com>
+Danny Chan <yu...@gmail.com>
+Darion Yaphet <da...@gmail.com>
+David Handermann <ex...@apache.org>
+Dhirenda Gautam <dh...@datametica.com>
+Divyanshu Srivastava <di...@datametica.com>
+Dmitry Sysolyatin <dm...@gmail.com>
+Dmitry Sysolyatin <dm...@gmail.com>
+Drew Schmitt <da...@google.com>
+Dylan Adams <dy...@gmail.com>
+Evgeniy Stanilovskiy <eu...@netdava.com> # aka Eugen Stan, Evgeny Stanilovsky
+Evgeniy Stanilovskiy <st...@gmail.com>
+Feng Guo <gu...@bytedance.com>
+Feng Zhu <fe...@apache.org> # DonnyZone at github
+Feng Zhu <fe...@ebay.com>
+Feng Zhu <we...@gmail.com>
+Feng Zhu <we...@tencent.com>
+Godfrey He <go...@163.com>
+Hequn Cheng <ch...@gmail.com>
+Hong Shen (沈洪) <yu...@alipay.com>
+Hongyu Guo <ma...@tencent.com>
+Hongze Zhang <ho...@tencent.com>
+Hsuan-Yi Chu <hs...@apache.org>
+Ian Bertolacci <ia...@workday.com>
+Jacky Lau <ja...@apache.org> # aka Yong Liu
+Jacky Lau <yo...@alibaba-inc.com>
+Jacky Woo <wu...@qq.com>
+Jacky Yin <ja...@eoitek.com>
+James Kim <ja...@dremio.com>
+Janhui Dong <do...@meituan.com>
+Jark Wu (云邪) <wu...@alibaba-inc.com>
+Jasmin Trada <ja...@dremio.com>
+Jay Narale <ja...@dremio.com>
+Jeffery Zhang (张俭) <zj...@ly.com>
+Jerin John <je...@google.com>
+Jiajun Xie <ji...@foxmail.com> # aka Jake Xie, Jiajin Bernoulli
+Jiasen Sheng <an...@gmail.com>
+Jin Xing <ji...@gmail.com>
+Jin Xing <jx...@antfin.com> # aka jx158167
+Joey Moore <jh...@google.com>
+Johannes Schulte <jo...@gmail.com>
+Julian Feinauer <j....@pragmaticminds.de>
+Julian Hyde <jh...@apache.org>
+Julian Hyde <jh...@hydromatic.net>
+Julian Hyde <ju...@looker.com>
+Julian Hyde <ju...@gmail.com>
+Kevin Liew <kl...@apache.org>
+Kevin Liew <kl...@users.noreply.github.com>
+Khawla Mouhoubi <mo...@gmail.com>
+Konstantin Orlov <ko...@gridgain.com>
+Krisztian Kasa <ka...@gmail.com>
+Lei Shen <sh...@zbyte-inc.com>
+LeoWangLZ <wa...@163.com> # aka Rheet Wong?
+Liao Xintao <ch...@taobao.com>
+Lincoln Lee <li...@alibaba-inc.com>
+Liya Fan <fa...@foxmail.com>
+Louis Kang <lo...@google.com> # aka LM Kang
+Maryann Xue <ma...@gmail.com>
+Maryann Xue <we...@intel.com>
+Min Dai <da...@outlook.com>
+Mingcan Wang <ji...@126.com>
+Mou Wu <wu...@outlook.com>
+Mou Wu <wu...@alibaba-inc.com>
+Nick Riasanovsky <ni...@bodo.ai> # aka Nicholas J Riasanovsky
+Nishant Bangarwa <ni...@gmail.com>
+Pavel Gubin <pa...@contiamo.com>
+Pawel Ruchaj <pa...@profimedia.co.uk>
+Peng Wang <fo...@tencent.com>
+pengzhiwei <pe...@icloud.com>
+Praveen Kumar <pr...@dremio.com>
+Qi Yu (余启) <yu...@xiaomi.com>
+Qianjin Xu <x1...@163.com>
+Rafay Qureshi <qu...@gmail.com>
+Ruben Quesada Lopez <ru...@gmail.com>
+Rui Wang <am...@163.com>
+Runkang He (何润康) <he...@bytedance.com>
+Runkang He (何润康) <hr...@gmail.com>
+Sandeep Chada <44...@users.noreply.github.com>
+Sergei Tsvetkov <93...@gmail.com>
+Sergey Nuyanzin <sn...@gmail.com>
+Shikha Somani <sh...@servicesource.com>
+Shradha Ambekar <Sh...@intuit.com>
+Shuming Li <mi...@gmail.com>
+Shuo Cheng <sh...@alibaba-inc.com>
+Slim Bouguerra <sl...@gmail.com>
+Stamatis Zampetakis <15...@users.noreply.github.com>
+Stamatis Zampetakis <za...@gmail.com>
+Taras Ledkov <tl...@gridgain.com>
+Ted Xu (少杰) <sh...@alibaba-inc.com>
+Venki Korukanti <ve...@gmail.com>
+Venki Korukanti <ve...@dremio.com>
+Vladimir Ozerov <pp...@gmail.com>
+Vova Vysotskyi <vv...@gmail.com>
+Wang Yanlin <19...@163.com>
+Wang Yanlin <ya...@antfin.com>
+Weijie Wu <wu...@apache.org>
+Wenhui Tang <we...@yeah.net>
+Wenrui Meng <we...@singleorigin.tech>
+Xiaogang Zhou <zh...@shizhuang-inc.com>
+Xiong Duan <no...@gmail.com>
+Xu ZhaoHui <95...@qq.com> # aka dz, xzh
+Xurenhe <xu...@gmail.com> # aka wojustme
+Yanjing Wang <ha...@tencent.com>
+Yeong Wei <la...@persistent.my>
+Yingyu Wang <yi...@gmail.com>
+Yingyu Wang <yi...@users.noreply.github.com>
+Yiqun Zhang <gu...@gmail.com>
+Zhe Hu <il...@163.com>
+Zhen Wang <aw...@marinsoftware.com>
+Zhen Wang <zi...@gmail.com>
+Zhengqiang Duan <du...@apache.org>
+Zhiqiang He <ab...@qq.com>
+Zhiqiang He <zh...@apache.org>
+Zhong Yu <yu...@alibaba-inc.com>
+Zou Dan <zo...@bytedance.com>
+Zuozhi Wang <zu...@alibaba-inc.com>
diff --git a/core/src/test/java/org/apache/calcite/test/LintTest.java b/core/src/test/java/org/apache/calcite/test/LintTest.java
index 01e283efb5..a0ceb69e3e 100644
--- a/core/src/test/java/org/apache/calcite/test/LintTest.java
+++ b/core/src/test/java/org/apache/calcite/test/LintTest.java
@@ -32,6 +32,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
 import org.checkerframework.checker.nullness.qual.Nullable;
 import org.junit.jupiter.api.Test;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -408,6 +409,39 @@ class LintTest {
     }
   }
 
+  /** Ensures that the {@code .mailmap} file is sorted. */
+  @Test void testMailmapFile() {
+    final List<File> files = TestUnsafe.getTextFiles();
+    final File contributorsFile =
+        getOnlyElement(
+            filter(files, f -> f.getName().equals(".mailmap")));
+    final List<String> lines = new ArrayList<>();
+    forEachLineIn(contributorsFile, line -> {
+      if (!line.startsWith("#")) {
+        lines.add(line);
+      }
+    });
+    String line = firstOutOfOrder(lines, String.CASE_INSENSITIVE_ORDER);
+    if (line != null) {
+      fail("line '" + line + "' is out of order");
+    }
+  }
+
+  /** Performs an action for each line in a file. */
+  private static void forEachLineIn(File file, Consumer<String> consumer) {
+    try (BufferedReader r = Util.reader(file)) {
+      for (;;) {
+        String line = r.readLine();
+        if (line == null) {
+          break;
+        }
+        consumer.accept(line);
+      }
+    } catch (IOException e) {
+      throw Util.throwAsRuntime(e);
+    }
+  }
+
   /** Returns the first element in a list that is out of order, or null if the
    * list is sorted. */
   private static <E> @Nullable E firstOutOfOrder(Iterable<E> elements,
diff --git a/core/src/test/java/org/apache/calcite/util/TestUnsafe.java b/core/src/test/java/org/apache/calcite/util/TestUnsafe.java
index e9e24118c0..71b4d83d5a 100644
--- a/core/src/test/java/org/apache/calcite/util/TestUnsafe.java
+++ b/core/src/test/java/org/apache/calcite/util/TestUnsafe.java
@@ -156,7 +156,8 @@ public abstract class TestUnsafe {
   /** Returns a list of text files in git. */
   public static List<File> getTextFiles() {
     return getGitFiles("*.bat", "*.cmd", "*.csv", "*.fmpp", "*.ftl",
-        "*.iq", "*.java", "*.json", "*.jj", "*.kt", "*.kts", "*.md",
+        "*.iq", "*.java", "*.json", "*.jj",
+        "*.kt", "*.kts", ".mailmap", "*.md",
         "*.properties", "*.sh", "*.sql", "*.txt", "*.xml", "*.yaml",
         "*.yml");
   }
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index fcb0b68241..50bce36a2f 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -756,15 +756,16 @@ Before you start:
   a fix version assigned (most likely the version we are
   just about to release)
 
-Generate a list of contributors by running the following (changing the
-date literal to the date of the previous release):
+Generate a list of contributors:
 ```
+# Commits since 1.35
+range=calcite-1.35.0..HEAD
 # distinct authors
-./sqlsh "select distinct author from git_commits where author_timestamp > DATE '2021-06-03' order by 1"
+git log --abbrev-commit --pretty=format:'%aN,' $range | sort -u
 # most prolific authors
-./sqlsh "select author, count(*) from git_commits where commit_timestamp > DATE '2021-06-03' group by author order by 2"
-# number of commits, distinct authors, and JIRA cases
-./sqlsh "select count(*) as c, count(distinct author) as a, count(*) filter (where message like '%CALCITE-%') as j from git_commits where commit_timestamp > DATE '2021-06-03' order by 1"
+git log --abbrev-commit --pretty=format:'%aN' $range | sort | uniq -c | sort -nr
+# number of JIRA cases
+git log --abbrev-commit --pretty=format:'%f' $range | awk -F- '$1 == "CALCITE" {print $2}' | sort -u | wc
 ```
 
 Smoke-test `sqlline` with Spatial and Oracle function tables: