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): Delete branches removed from reorder plan #174

Conversation

twavv
Copy link
Contributor

@twavv twavv commented Jun 8, 2023

Example

Have a branch structure:

* 2023-06-08-two-b ce20b00  (HEAD -> 2023-06-08-two)
| 
* 2023-06-08-two-a 1f8f16b 
| 
* 2023-06-08-one-b 061ed6e  (2023-06-08-one)
| 
* 2023-06-08-one-a a4db90d 
| 
* 2023-05-30-one-a (#957) 87232f0  (origin/main, origin/HEAD, main)

Run av stack reorder and delete the stack-branch 2023-06-08-two line (effectively merging all commits into 2023-06-08-one):

image

Choose e to edit the plan:
image
(looks like unfortunately we lose the comment information, but this can be fixed in a future change)

Save the same plan, choose o to orphan the branches:
image

Confirmed that 2023-06-08-two still exists and hasn't had it's HEAD modified.

Reset to the state above, but this time choose d to delete the branches:
image

@aviator-app
Copy link
Contributor

aviator-app bot commented Jun 8, 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 marked this pull request as ready for review June 8, 2023 21:55
sb := strings.Builder{}
sb.WriteString("delete-branch ")
sb.WriteString(d.Name)
if d.DeleteRef {
Copy link
Contributor

Choose a reason for hiding this comment

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

--delete-ref looks confusing? A branch is a ref.

Aside from that, do we want to have this command? It seems that simply deleting a line would be suffice to support deleting branches, and for I cannot think a good use case for this command.

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, I meant it to disambiguate deleting av's version of the branch and deleting the actual Git ref. It could also be --delete-git but I'm not sure if that's actually any clearer. Maybe --delete-git-ref would be the clearest of all.

But to your point, the only reason I implemented this as a command is convenience of implementation. It's nice to be able to just append the DeleteBranch commands to the reorder plan if we detect that the branches have been removed from the plan (which is what we do here). We probably don't even need to document that this exists. We only even need the flag version because the command is serialized as a string whenever we write the continuation to file.

@aviator-app aviator-app bot merged commit 7a612c8 into master Jun 12, 2023
@aviator-app aviator-app bot deleted the travis/mer-2443-av-stack-reorder-delete-branches-removed-from-plan branch June 12, 2023 22: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