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

Add gps import command #272

Open
drewdeponte opened this issue Nov 8, 2023 · 3 comments
Open

Add gps import command #272

drewdeponte opened this issue Nov 8, 2023 · 3 comments
Assignees

Comments

@drewdeponte
Copy link
Owner

The idea with the gps import command is that you would be able to gps import -n <branch-name> and it would cherry pick the commits from that branch onto the top of your patch stack. Effectively, conceptually importing the patches from a branch into your patch stack. Duplicates would naturally collapse a way.

I think this should almost be a proxy command as I want to execute the external git cherry-pick command in range made. That way the conflict resolution, etc. is all standard to Git.

It won't actually be just a proxy as it has to do some analysis of the Git tree and figure out where the range of patches should start and where it should end so that we can pass those shas onto the git cherry-pick <start-exclusive-sha>..<end-sha-inclusive> or git cherry-pick <start-inclusive-sha>^..<end-sha-inclusive>.

This could be useful for the scenario where you have requested review of a patch and a co-worker has pushed up an additional commit to your rr branch. You likely would want to import the patches from that remote branch. This would import your own patch which would go away as a duplicate, but then it would also import the patch from your co-worker. This would then allow you to iterate on the patch to get a new version and ready and re-request review.

@drewdeponte drewdeponte converted this from a draft issue Nov 8, 2023
@drewdeponte drewdeponte moved this from Triage to Discussion in git-ps-rs Nov 8, 2023
@drewdeponte drewdeponte added this to the 7.0.0 milestone Nov 8, 2023
@drewdeponte drewdeponte self-assigned this Nov 8, 2023
@drewdeponte
Copy link
Owner Author

Given the use case presented above, gps import <patch-index> might be a nice usage at least for the scenario where a branch is already associated with a patch. That way the user doesn't have think about the branch name.

We would also need to support gps import <ref-name> though so that we can import patches from other references.

@drewdeponte
Copy link
Owner Author

drewdeponte commented Nov 12, 2023

Thinking about this some more. I think what this should do is actually find the common ancestor between the specified branch name (or associated branch when patch index is provided) and the currently checked out patch stack. Then it should present the list of patch that will be cherry picked if the user decides to continue by enterying y/yes when prompted. Any other value will abort the import.

The reason I think this is important is because if the user specifies a branch that wasn't directly based on the currently checked out patch stack, they wouldn't have any idea and it would import possible a large number of patches into the stack. So, I just think it is better to prompt the user to make sure they want to import the patches.

@drewdeponte drewdeponte removed this from the 7.0.0 milestone Jan 5, 2024
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

No branches or pull requests

1 participant