Skip to content

Conversation

jswrenn
Copy link
Member

@jswrenn jswrenn commented Nov 14, 2023

UPDATE: Changelog complete!

Still need to write changelog. Is there any way to easily get all PRs merged after a date/tag? Running this:

git log v0.11.0.. --reverse --merges --oneline --grep='Merge #' | cut -d' ' -f3 | sort -n 

Only turned up merge commits for:

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).

@jswrenn jswrenn added this to the next milestone Nov 14, 2023
@Philippe-Cholet
Copy link
Member

Philippe-Cholet commented Nov 14, 2023

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):

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.

@jswrenn
Copy link
Member Author

jswrenn commented Nov 14, 2023

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.

@jswrenn jswrenn marked this pull request as ready for review November 14, 2023 18:04
@Philippe-Cholet
Copy link
Member

Philippe-Cholet commented Nov 14, 2023

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" 
Copy link
Member

@phimuemue phimuemue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Looks good to me.

@jswrenn jswrenn added this pull request to the merge queue Nov 14, 2023
Merged via the queue into master with commit 22fc427 Nov 14, 2023
@jswrenn jswrenn deleted the prepare-0.12.0 branch November 14, 2023 19:14
@Philippe-Cholet
Copy link
Member

@jswrenn There is #![doc(html_root_url = "https://docs.rs/itertools/0.11/")] in lib.rs.

@jswrenn
Copy link
Member Author

jswrenn commented Nov 14, 2023

Whoops, I thought we deleted that.

Philippe-Cholet added a commit to Philippe-Cholet/itertools that referenced this pull request Nov 22, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants