Skip to content

Conversation

@topher200
Copy link
Contributor

@topher200 topher200 commented Jun 23, 2021

stg rebase --interactive is a new tool which mirrors git rebase --interactive.

Using an editor --interactive lets the user reorder patches, squash patch chains, or delete individual patches.

asciicast

Further instructions could be added but this seemed like a good base set. I've been using this locally and it helps execute certain sets of commands much faster! Tests are included.

@topher200 topher200 force-pushed the rebase-interactive branch from 897f303 to 20d631c Compare June 23, 2021 16:16
@topher200 topher200 marked this pull request as draft June 23, 2021 16:19
@topher200
Copy link
Contributor Author

topher200 commented Jun 23, 2021

It seems like the tests for Python 3.5 and 3.6 are broken due to no @dataclass. I'll need to implement a replacement.

Update: fixed!

@topher200 topher200 marked this pull request as ready for review June 24, 2021 04:09
@topher200 topher200 requested a review from jpgrayson June 24, 2021 04:11
@topher200 topher200 force-pushed the rebase-interactive branch 3 times, most recently from 4a8e9fa to 2f9429f Compare June 25, 2021 05:28
Copy link
Collaborator

@jpgrayson jpgrayson 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 implementing this feature. I'm suspect this will be valuable to many StGit users.

I've added a few review comments for you to consider, but I think this code is good enough as-is. Thank you also for writing tests!

`stg rebase --interactive` is a new tool which mirrors `git rebase
--interactive`.

Using an editor `--interactive` lets the user [reorder
patches](https://asciinema.org/a/421486), [squash patch
chains](https://asciinema.org/a/421488), or [delete individual
patches](https://asciinema.org/a/421487) (links go to recordings showing
these features!).

Further instructions could be added but this seemed like a good base
set. I've been using this locally and it helps execute certain sets of
commands much faster! Tests are included.

Signed-off-by: Topher Brown <[email protected]>
@topher200 topher200 force-pushed the rebase-interactive branch from 2f9429f to ff4d175 Compare June 25, 2021 15:03
@topher200
Copy link
Contributor Author

Thank you also for writing tests!

The test suite is what drew me to write this as a first-class citizen in the first place! (as opposed to a separate script in contrib). Once I got the hang of the harnesses I found it very easy to use a TDD style for adding new features to rebase.

I'd love any feedback you have on how to clean up the tests. I went for verbosity over DRY whenever I was confused, which is great because it led to landing the feature quickly 😂. Happy to clean them up however you see fit.

One (potential) downside of the way the --interactive tests are currently architected is that we can only set fake-editor once. That means that if two editor windows are opened by a single command (easy to do: write a stg rebase --interactive which includes a squash instruction, example: 1), we don't have any control over that second editor (in this case, the squash). The git repo gets around this restriction by having two fake-editors and somehow using the second one for the squash, but I didn't go there. Instead I just wrote my tests such that the commit message of the squash patch isn't relevant to the test. I don't think it's a big deal, just something I wanted to mention.

I have a few test steps like this: stg delete $(stg series --all --noprefix --no-description) &&. I needed to delete all patches to reset my stack (mostly due to the editor issue above 😂). I'm surprised there wasn't a lib function to do this already -- feel free suggest an alternative way of refreshing the stack (or creating a new stack) in the middle of a suite of tests.

@jpgrayson jpgrayson merged commit e217ebb into stacked-git:master Jun 28, 2021
@topher200 topher200 deleted the rebase-interactive branch July 6, 2021 04:56
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