Skip to content

Commit

Permalink
[CALCITE-6125] Automate generation of contributor names in release no…
Browse files Browse the repository at this point in the history
…tes 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 #3533
  • Loading branch information
julianhyde committed Nov 20, 2023
1 parent 1eb6551 commit 343132e
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 7 deletions.
148 changes: 148 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Adam Kennedy <[email protected]>
Alan Jin <[email protected]>
Ali Mansour <[email protected]>
Amir Gajst <[email protected]>
Botong Huang <[email protected]>
Cancai Cai <[email protected]>
Charbel Yazbeck <[email protected]>
Chen Kai <[email protected]>
Chunhui Shi <[email protected]>
Chunwei Lei <[email protected]>
Chunwei Lei <[email protected]>
Chunwei Lei <[email protected]>
Daniel Henneberger <[email protected]>
Daniel Henneberger <[email protected]>
Danny Chan <[email protected]>
Danny Chan <[email protected]>
Darion Yaphet <[email protected]>
David Handermann <[email protected]>
Dhirenda Gautam <[email protected]>
Divyanshu Srivastava <[email protected]>
Dmitry Sysolyatin <[email protected]>
Dmitry Sysolyatin <[email protected]>
Drew Schmitt <[email protected]>
Dylan Adams <[email protected]>
Evgeniy Stanilovskiy <[email protected]> # aka Eugen Stan, Evgeny Stanilovsky
Evgeniy Stanilovskiy <[email protected]>
Feng Guo <[email protected]>
Feng Zhu <[email protected]> # DonnyZone at github
Feng Zhu <[email protected]>
Feng Zhu <[email protected]>
Feng Zhu <[email protected]>
Godfrey He <[email protected]>
Hequn Cheng <[email protected]>
Hong Shen (沈洪) <[email protected]>
Hongyu Guo <[email protected]>
Hongze Zhang <[email protected]>
Hsuan-Yi Chu <[email protected]>
Ian Bertolacci <[email protected]>
Jacky Lau <[email protected]> # aka Yong Liu
Jacky Lau <[email protected]>
Jacky Woo <[email protected]>
Jacky Yin <[email protected]>
James Kim <[email protected]>
Janhui Dong <[email protected]>
Jark Wu (云邪) <[email protected]>
Jasmin Trada <[email protected]>
Jay Narale <[email protected]>
Jeffery Zhang (张俭) <[email protected]>
Jerin John <[email protected]>
Jiajun Xie <[email protected]> # aka Jake Xie, Jiajin Bernoulli
Jiasen Sheng <[email protected]>
Jin Xing <[email protected]>
Jin Xing <[email protected]> # aka jx158167
Joey Moore <[email protected]>
Johannes Schulte <[email protected]>
Julian Feinauer <[email protected]>
Julian Hyde <[email protected]>
Julian Hyde <[email protected]>
Julian Hyde <[email protected]>
Julian Hyde <[email protected]>
Kevin Liew <[email protected]>
Kevin Liew <[email protected]>
Khawla Mouhoubi <[email protected]>
Konstantin Orlov <[email protected]>
Krisztian Kasa <[email protected]>
Lei Shen <[email protected]>
LeoWangLZ <[email protected]> # aka Rheet Wong?
Liao Xintao <[email protected]>
Lincoln Lee <[email protected]>
Liya Fan <[email protected]>
Louis Kang <[email protected]> # aka LM Kang
Maryann Xue <[email protected]>
Maryann Xue <[email protected]>
Min Dai <[email protected]>
Mingcan Wang <[email protected]>
Mou Wu <[email protected]>
Mou Wu <[email protected]>
Nick Riasanovsky <[email protected]> # aka Nicholas J Riasanovsky
Nishant Bangarwa <[email protected]>
Pavel Gubin <[email protected]>
Pawel Ruchaj <[email protected]>
Peng Wang <[email protected]>
pengzhiwei <[email protected]>
Praveen Kumar <[email protected]>
Qi Yu (余启) <[email protected]>
Qianjin Xu <[email protected]>
Rafay Qureshi <[email protected]>
Ruben Quesada Lopez <[email protected]>
Rui Wang <[email protected]>
Runkang He (何润康) <[email protected]>
Runkang He (何润康) <[email protected]>
Sandeep Chada <[email protected]>
Sergei Tsvetkov <[email protected]>
Sergey Nuyanzin <[email protected]>
Shikha Somani <[email protected]>
Shradha Ambekar <[email protected]>
Shuming Li <[email protected]>
Shuo Cheng <[email protected]>
Slim Bouguerra <[email protected]>
Stamatis Zampetakis <[email protected]>
Stamatis Zampetakis <[email protected]>
Taras Ledkov <[email protected]>
Ted Xu (少杰) <[email protected]>
Venki Korukanti <[email protected]>
Venki Korukanti <[email protected]>
Vladimir Ozerov <[email protected]>
Vova Vysotskyi <[email protected]>
Wang Yanlin <[email protected]>
Wang Yanlin <[email protected]>
Weijie Wu <[email protected]>
Wenhui Tang <[email protected]>
Wenrui Meng <[email protected]>
Xiaogang Zhou <[email protected]>
Xiong Duan <[email protected]>
Xu ZhaoHui <[email protected]> # aka dz, xzh
Xurenhe <[email protected]> # aka wojustme
Yanjing Wang <[email protected]>
Yeong Wei <[email protected]>
Yingyu Wang <[email protected]>
Yingyu Wang <[email protected]>
Yiqun Zhang <[email protected]>
Zhe Hu <[email protected]>
Zhen Wang <[email protected]>
Zhen Wang <[email protected]>
Zhengqiang Duan <[email protected]>
Zhiqiang He <[email protected]>
Zhiqiang He <[email protected]>
Zhong Yu <[email protected]>
Zou Dan <[email protected]>
Zuozhi Wang <[email protected]>
34 changes: 34 additions & 0 deletions core/src/test/java/org/apache/calcite/test/LintTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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;
Expand Down Expand Up @@ -408,6 +409,39 @@ private static void checkMessage(String subject, String body,
}
}

/** 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,
Expand Down
3 changes: 2 additions & 1 deletion core/src/test/java/org/apache/calcite/util/TestUnsafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public static List<File> getJavaFiles() {
/** 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");
}
Expand Down
13 changes: 7 additions & 6 deletions site/_docs/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 343132e

Please sign in to comment.