Skip to content

fix: handle cargo milestone update for PR from GitHub merge queue - #1861

Merged
ehuss merged 3 commits into
rust-lang:masterfrom
weihanglo:milestone-cargo
Nov 30, 2024
Merged

ehuss merged 3 commits into
rust-lang:masterfrom
weihanglo:milestone-cargo

Conversation

@weihanglo

Copy link
Copy Markdown
Member

Cargo has migrated to GitHub merge queue:
rust-lang/cargo#14718

The regex doesn't work for merge commit made by GitHub merge queue.
This PR adds extra regex pattern to capture that.

This regex has been proved working locally.
See ehuss/cargo-new-release#2

cc @ehuss

Comment on lines +155 to +159
.filter(|commit|
// Assumptions:
// * A merge commit always has two parent commits.
// * Cargo's PR never got merged as fast-forward / rebase / squash merge.
commit.parents.len() == 2)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While the regex below has been proved working, this filter hasn't. This may not be necessary. I added because for preventive purpose.

Comment thread src/handlers/milestone_prs.rs Outdated
commit.commit.message.len()
);

merge_re.captures(&commit.commit.message).map(|cap| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering, would it be a good idea to only look at the first line of the commit message? I'm wondering what would happen if there is a stray mention of another issue/PR in the body somewhere, like:

fix(fix): Migrate cargo script manifests across editions (#14864)

This is a multi-line description
that happens to mention an issue (#1234)
somewhere in its text.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking at this closer, this regex doesn't seem to work with a multi-line commit message. For example:

Improve error handling when PathSource is relative (#14854)

When editing dependencies with cargo, if a relative PathSource is
supplied cargo panics with "both paths are absolute". This is the
opposite of what's actually wrong leading to confusion.

Instead, use the same error formatting we use in other diff_paths calls
and return that error instead of panicking.

This is not matching here, since the $ requires the (#14854) to be at the end of the message (since regex does not have mutliline enabled by default).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hah! I overlooked that difference. Thanks for investigating I'll update to check the first line only then.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in 7229b2a!

Comment thread src/handlers/milestone_prs.rs Resolved
Cargo has migrated to GitHub merge queue:
rust-lang/cargo#14718

The regex doesn't work for merge commit made by GitHub merge queue.
This PR adds extra regex pattern to capture that.

This regex has been proved working locally.
See <ehuss/cargo-new-release#2>

@ehuss ehuss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! I pushed a small change to remove a panic if the commit message is empty. Although unlikely (or impossible?) to happen, I didn't feel comfortable crashing triagebot if it does.

Although this is unlikely (or impossible?) to ever happen in practice,
I don't feel comfortable with crashing triagebot if it ever happens.
@ehuss
ehuss merged commit 4b28086 into rust-lang:master Nov 30, 2024
@weihanglo
weihanglo deleted the milestone-cargo branch November 30, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants