Skip to content

Commit

Permalink
Merge #42339
Browse files Browse the repository at this point in the history
42339: scripts/release-notes.py: derive author aliases from AUTHORS r=knz a=knz

Previously, the release-notes script contained an explicit list of
contributors to the repo with their name aliases, to disambiguate
entries in the git log while constructing the release notes report.

The explicit list was problematic in numerous ways, foremost because
it was often out of date and incomplete, and also because it couldn't
distinguish different folk with the same name but different addresses.

Luckily, Git has a standard solution for this problem, called a
"mailmap" file. The format of this file is standardized and documented
in the man page git-check-mailmap(1). To simplify, this file format
has one line per _person_, and each line can contain multiple
name/mail combinations for that person.

Meanwhile, the CockroachDB repository also maintains a file `AUTHORS`
at the top of the source tree. This also contains a list of
contributors with names and e-mails, although for far this file was
not maintained to conform exactly to Git's mailmap format.

This commit bridges the two things as follows:

- it updates the `AUTHORS` file to conform to the mailmap format.
  This removes duplicate entries, and spells out Git commit/author
  aliases alongside the primary name of a person.
- it simplifies the release-notes script to use AUTHORS
  as its input database.

Release note: None

Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
craig[bot] and knz committed Nov 25, 2019
2 parents baeaf6b + a242b72 commit 68553f3
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 206 deletions.
144 changes: 75 additions & 69 deletions AUTHORS

Large diffs are not rendered by default.

281 changes: 149 additions & 132 deletions scripts/release-notes.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion scripts/release-notes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TESTS := $(wildcard test*.sh)
BASH ?= /usr/bin/env bash
PYTHON ?= python
NOTESCRIPT := $(PWD)/../release-notes.py
TDIR := $(shell pwd)

all: test

Expand All @@ -15,7 +16,7 @@ test: $(TESTS:.sh=.test)
@echo
@echo "**** Testing for $* ****"
@echo
$(BASH) $*.sh $(NOTESCRIPT)
$(BASH) $(TDIR)/$*.sh $(NOTESCRIPT)

clean:
rm -f *.graph.txt *.notes.txt
Expand Down
1 change: 1 addition & 0 deletions scripts/release-notes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function test_init() {
function init_repo() {
git init
touch foo; git add foo; git commit "${flags[@]}" -m "initial"; git tag initial
git tag v000-base
}

# Perform some arbitrary change.
Expand Down
2 changes: 1 addition & 1 deletion scripts/release-notes/test1.notes.ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#### Changes without release note annotation

- [#unknown][#unknown] [e3a1f2c94][e3a1f2c94] master update (test1)
- [#unknown][#unknown] [e3a1f2c94][e3a1f2c94] master update (test1 <[email protected]>)

### Doc updates

Expand Down
2 changes: 1 addition & 1 deletion scripts/release-notes/test2.notes.ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#### Changes without release note annotation

- [#unknown][#unknown] [f872999e8][f872999e8] master update (test2)
- [#unknown][#unknown] [f872999e8][f872999e8] master update (test2 <[email protected]>)

### Doc updates

Expand Down
2 changes: 1 addition & 1 deletion scripts/release-notes/test3.notes.ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#### Changes without release note annotation

- [#unknown][#unknown] [4f4329fdc][4f4329fdc] master update (test3)
- [#unknown][#unknown] [4f4329fdc][4f4329fdc] master update (test3 <[email protected]>)

### Doc updates

Expand Down
2 changes: 1 addition & 1 deletion scripts/release-notes/test5.notes.ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#### Changes without release note annotation

- [#2][#2] [8156afc96][8156afc96] PR title in need of release note (test5)
- [#2][#2] [8156afc96][8156afc96] PR title in need of release note (test5 <[email protected]>)

### Doc updates

Expand Down
18 changes: 18 additions & 0 deletions scripts/release-notes/test8.graph.ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
* 801acad030ef8c14766f72609287d323075af29b Merge pull request #200 from foo/bar
|\
| * 4ba203f0af12e361707c20fa4254fe58f9c3a86e merge pr canary
|/
* 20f736f8b7421f226d15111e2377a8e069972bf0 Merge #2
|\
| * fc02f2ab9ac0c1924c479fa601065235579a605e feature A2
|/
* ac02f9cf6095d6430c609812730a34fe254f5e77 Merge pull request #100 from foo/bar
|\
| * 1fa346db29169f9d1c6f229e34e1e0b0af687af7 merge pr canary
|/
* 931a977579e2e0f0efee763fa289bd2b3162755b Merge #1
|\
| * f76e64ed372d84433ac4c5e0a06e3dfe34a80686 feature A1
|/
* a1dec56519bfa4d850e2771bd9880d2dcdb715aa update AUTHORS
* 15d3108780a91a71af56bdaeb020dbdf650fd1ef initial
45 changes: 45 additions & 0 deletions scripts/release-notes/test8.notes.ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Miscellaneous

#### Changes without release note annotation

- [#2][#2] [fc02f2ab9][fc02f2ab9] PR 2 title (Foo Foo <[email protected]>, test8 <[email protected]>)
- [#1][#1] [f76e64ed3][f76e64ed3] PR 1 title (Foo Foo <[email protected]>, test8 <[email protected]>)
- [#unknown][#unknown] [a1dec5651][a1dec5651] update AUTHORS (test8 <[email protected]>)

### Doc updates

Docs team: Please add these manually.

### Contributors

This release includes 4 merged PRs by 2 authors.
We would like to thank the following contributors from the CockroachDB community:

- Foo Foo (first-time contributor)
- test8

### PRs merged by contributors

- Foo Foo, test8:
- 2018-04-22 [#2 ][#2 ] [20f736f8b][20f736f8b] (+ 0 - 0 ~ 0/ 0) PR 2 title
- 2018-04-22 [#1 ][#1 ] [931a97757][931a97757] (+ 0 - 0 ~ 0/ 0) PR 1 title

- test8:
- 2018-04-22 [#unknown][#unknown] [a1dec5651][a1dec5651] (+ 1 - 0 ~ 1/ 1) update AUTHORS
- 2018-04-22 [#200 ][#200 ] [801acad03][801acad03] (+ 0 - 0 ~ 0/ 0) PR 2 title alternate format
- 2018-04-22 [#100 ][#100 ] [ac02f9cf6][ac02f9cf6] (+ 0 - 0 ~ 0/ 0) PR 1 title alternate format


[#1]: https://github.com/cockroachdb/cockroach/pull/1
[#100]: https://github.com/cockroachdb/cockroach/pull/100
[#2]: https://github.com/cockroachdb/cockroach/pull/2
[#200]: https://github.com/cockroachdb/cockroach/pull/200
[#unknown]: https://github.com/cockroachdb/cockroach/pull/unknown
[20f736f8b]: https://github.com/cockroachdb/cockroach/commit/20f736f8b
[801acad03]: https://github.com/cockroachdb/cockroach/commit/801acad03
[931a97757]: https://github.com/cockroachdb/cockroach/commit/931a97757
[a1dec5651]: https://github.com/cockroachdb/cockroach/commit/a1dec5651
[ac02f9cf6]: https://github.com/cockroachdb/cockroach/commit/ac02f9cf6
[f76e64ed3]: https://github.com/cockroachdb/cockroach/commit/f76e64ed3
[fc02f2ab9]: https://github.com/cockroachdb/cockroach/commit/fc02f2ab9

37 changes: 37 additions & 0 deletions scripts/release-notes/test8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
set -eux

. common.sh

t=test8
relnotescript=${1:?}
rewrite=${2:-}

test_init

(
cd $t
init_repo

cat >AUTHORS <<EOF
Foo Foo <[email protected]> foo <[email protected]> <[email protected]>
EOF
git add AUTHORS
make_change "update AUTHORS"

git checkout -b feature
make_change "feature A1"
git commit --allow-empty --amend --author='foo <[email protected]>' --no-edit
tag_pr 1
git checkout master
merge_pr feature 1 "PR 1 title"

git checkout -b feature2
make_change "feature A2"
git commit --allow-empty --amend --author='foo <[email protected]>' --no-edit
tag_pr 2
git checkout master
merge_pr feature2 2 "PR 2 title"
)

test_end

0 comments on commit 68553f3

Please sign in to comment.