Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stack reorder): Implement PickCmd #126

Merged
merged 3 commits into from
May 26, 2023

Conversation

twavv
Copy link
Contributor

@twavv twavv commented May 24, 2023

Implements the actual pick command (along with adding the necessary other things like Repo.CherryPick).

@aviator-app
Copy link
Contributor

aviator-app bot commented May 24, 2023

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.

@twavv twavv requested a review from draftcode May 24, 2023 17:25
// Use FastForward to avoid always amending commits.
FastForward: true,
})
if conflict, ok := errutils.As[git.ErrCherryPickConflict](err); ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is super bad practice. The alternative is doing

var conflict git.ErrCherryPickConflict
if errors.As(err, &conflict) {

which is only one extra line.

Let me know if this burns your eyes to look at and I'll change it 😅.

Copy link
Contributor

Choose a reason for hiding this comment

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

Really? I feel like I do this assign-in-if frequently to limit the scope. (Also mentioned in https://go.dev/doc/effective_go#if)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the only difference here is that we have to declare the concrete type of the error which isn't possible without using generics here. There's no

if var conflict git.ErrCherryPickConflict; errors.As(err, &conflict) { ... }

construct in Go.

I guess I could also do

if conflict := git.ErrCherryPickConflict{}; errors.As(err, &conflict) { ... }

but I've never seen that usage before.

Resume CherryPickResume
}

type CherryPickResult struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess initially thinking about returning this, but decided not to use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, good catch.

// Use FastForward to avoid always amending commits.
FastForward: true,
})
if conflict, ok := errutils.As[git.ErrCherryPickConflict](err); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Really? I feel like I do this assign-in-if frequently to limit the scope. (Also mentioned in https://go.dev/doc/effective_go#if)

@twavv
Copy link
Contributor Author

twavv commented May 26, 2023

/aviator stack merge

@aviator-app aviator-app bot changed the base branch from travis/mer-2320-av-stack-reorder to master May 26, 2023 15:07
@aviator-app aviator-app bot added the blocked label May 26, 2023
@aviator-app
Copy link
Contributor

aviator-app bot commented May 26, 2023

This pull request failed to merge: not queued. Remove the blocked label to re-queue.

@twavv
Copy link
Contributor Author

twavv commented May 26, 2023

/aviator stack cancel

@aviator-app
Copy link
Contributor

aviator-app bot commented May 26, 2023

This PR is stacked on top of #123 which was merged. This PR (and its dependents) need to be synchronized on the commit that was merged into master. From your repository, run the following commands:

# Switch to this branch
git checkout travis/mer-2345-av-stack-reorder-implement-pick
# Sync this branch (and its children) on top of the merge commit
av stack sync
# Optionally update pull requests to match new stack
av stack submit

@twavv twavv force-pushed the travis/mer-2345-av-stack-reorder-implement-pick branch from 2f7d349 to bb013d7 Compare May 26, 2023 15:13
@twavv twavv added mergequeue and removed blocked labels May 26, 2023
@aviator-app aviator-app bot merged commit f0cf48c into master May 26, 2023
@aviator-app aviator-app bot deleted the travis/mer-2345-av-stack-reorder-implement-pick branch May 26, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants