Closed jswrenn closed 11 months ago
git
is an awesome command line tool but it can't have all the informations that github has. So I would look at the github API instead. ...Merged PRs since 2023-06-22 (date for v0.11.0):
curl
and jq
, assuming there are less than 100 results (there are 52 today), the entire list is:
curl -H "Accept: application/vnd.github+json" https://api.github.com/search/issues?q=repo:rust-itertools/itertools+type:pr+merged:>2023-06-22&per_page=100 | jq ".items[].number"
The json data holds way more informations such as jq ".items[].pull_request.merged_at"
that could help sort them but I only knew about jq
before this.And after a quick search, an helpful git log --tags --simplify-by-decoration --pretty="format:%cs %d" | grep v0.11.0
.
(Or with %cI
) It could be used to merge this with the curl|jq
command.
Thanks! Coming at this from a slightly different angle, running this:
git log v0.11.0.. --reverse --oneline \
| cut -d' ' -f1 \
| xargs -I {} gh pr list --search {} --state merged --json number \
| jq '.[] | .number' \
| sort -nu
...gives:
...which is also 52 PRs! That sounds about right. I'll start putting together the changelog.
I dived into jq
to nicely sort merged PRs by the merged_at
key and came with two git aliases:
pulls-after-date = "!f() { curl -H 'Accept: application/vnd.github+json' 'https://api.github.com/search/issues?per_page=100&q=repo:rust-itertools/itertools+type:pr+merged:>'$1 | jq '.items | sort_by(.pull_request.merged_at) | .[].number'; }; f"
pulls-after-tag = "!f() { git pulls-after-date $(git log -1 --format=%as $1); }; f"
# %aI would be more precise than %as but it contains a "+" that messes with the github url.
Usage: git pulls-after-date 2023-06-22
or simply git pulls-after-tag v0.11.0
.
Aliases v2: any github repo ; use more precise date with %aI
instead of %as
but url-escape the contained +
to %2B
.
# e.g. rust-itertools/itertools
get-repo = "!f() { url=$(git remote get-url upstream); url=${url#'https://github.com/'}; url=${url%'.git'}; echo ${url}; }; f"
# List (up to 100) merged PRs for the current GitHub repo.
pulls-after-date = "!f() { date_for_url=${1/+/%2B}; curl -H 'Accept: application/vnd.github+json' 'https://api.github.com/search/issues?per_page=100&q=repo:'$(git get-repo)'+type:pr+merged:>'$date_for_url | jq '.items | sort_by(.pull_request.merged_at) | .[].number'; }; f"
# Get the date for a given tag, then call the main alias.
pulls-after-tag = "!f() { git pulls-after-date $(git log -1 --format=%aI $1); }; f"
@jswrenn There is #![doc(html_root_url = "https://docs.rs/itertools/0.11/")]
in lib.rs
.
Whoops, I thought we deleted that.
UPDATE: Changelog complete!
~Still need to write changelog.~ Is there any way to easily get all PRs merged after a date/tag? Running this:
Only turned up merge commits for:
709
713
715
718
723
727
735
737
739
745
But we have plenty more PRs that were merged without merge commits: https://github.com/rust-itertools/itertools/milestone/5?closed=1
I'm quite tempted to adopt a squash-before-merging approach before our next release to simplify this (so we could just list off all commits without too much noise).