From c3f0b5cb4ab604392f0958062b8d1779ecd9522b Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 17 Mar 2024 23:51:53 +1100 Subject: Update interactive rebase demo I'm adding an explicit delay between moving the commits and selecting the next items because otherwise it happens too fast --- README.md | 5 ++++- pkg/integration/components/view_driver.go | 6 ++++++ pkg/integration/tests/demo/interactive_rebase.go | 22 +++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ea8ae2bc7..879d2982b 100644 --- a/README.md +++ b/README.md @@ -114,10 +114,12 @@ Press space on the selected line to stage it, or press `v` to start selecting a ### Interactive Rebase -Press `e` on a commit to start an interactive rebase on it: causing all above commits to become part of the TODO file. Then squash (`s`), fixup (`f`), drop (`d`), edit (`e`), move up (`ctrl+i`) or move down (`ctrl+j`) any of TODO commits, before continuing the rebase by bringing up the rebase options menu with `m` and then selecting `continue`. +Press `i` to start an interactive rebase. Then squash (`s`), fixup (`f`), drop (`d`), edit (`e`), move up (`ctrl+i`) or move down (`ctrl+j`) any of TODO commits, before continuing the rebase by bringing up the rebase options menu with `m` and then selecting `continue`. You can also perform any these actions as a once-off (e.g. pressing `s` on a commit to squash it) without explicitly starting a rebase. +This demo also uses shift+down to select a range of commits to move and fixup. + ![interactive_rebase](../assets/demo/interactive_rebase-compressed.gif) ### Cherry-pick @@ -314,6 +316,7 @@ Funtoo Linux has an autogenerated lazygit package in [dev-kit](https://github.co ```sh sudo emerge dev-vcs/lazygit ``` + ### Gentoo Linux Lazygit is not (yet) in main Gentoo portage, however an ebuild is available in [GURU overlay](https://github.com/gentoo-mirror/guru/tree/master/dev-vcs/lazygit) diff --git a/pkg/integration/components/view_driver.go b/pkg/integration/components/view_driver.go index 567c4421d..8d9b336d6 100644 --- a/pkg/integration/components/view_driver.go +++ b/pkg/integration/components/view_driver.go @@ -397,6 +397,12 @@ func (self *ViewDriver) Press(keyStr string) *ViewDriver { return self } +func (self *ViewDriver) Delay() *ViewDriver { + self.t.Wait(self.t.inputDelay) + + return self +} + // for use when typing or navigating, because in demos we want that to happen // faster func (self *ViewDriver) PressFast(keyStr string) *ViewDriver { diff --git a/pkg/integration/tests/demo/interactive_rebase.go b/pkg/integration/tests/demo/interactive_rebase.go index 3d6709d87..b4a7337d6 100644 --- a/pkg/integration/tests/demo/interactive_rebase.go +++ b/pkg/integration/tests/demo/interactive_rebase.go @@ -14,12 +14,12 @@ var InteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ setDefaultDemoConfig(config) }, SetupRepo: func(shell *Shell) { - shell.CreateFile("my-file.txt", "myfile content") - shell.CreateFile("my-other-file.rb", "my-other-file content") + shell.CreateRepoHistory() - shell.CreateNCommitsWithRandomMessages(60) shell.NewBranch("feature/demo") + shell.CreateNCommitsWithRandomMessages(10) + shell.CloneIntoRemote("origin") shell.SetBranchUpstream("feature/demo", "origin/feature/demo") @@ -30,14 +30,18 @@ var InteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). IsFocused(). - NavigateToLine(Contains("Add TypeScript types to User module")). - Press(keys.Universal.Edit). - SelectPreviousItem(). + Press(keys.Commits.StartInteractiveRebase). + PressFast(keys.Universal.RangeSelectDown). + PressFast(keys.Universal.RangeSelectDown). + Press(keys.Commits.MarkCommitAsFixup). + PressFast(keys.Commits.MoveDownCommit). + PressFast(keys.Commits.MoveDownCommit). + Delay(). + SelectNextItem(). + SelectNextItem(). Press(keys.Universal.Remove). - SelectPreviousItem(). + SelectNextItem(). Press(keys.Commits.SquashDown). - SelectPreviousItem(). - Press(keys.Commits.MarkCommitAsFixup). Press(keys.Universal.CreateRebaseOptionsMenu). Tap(func() { t.ExpectPopup().Menu(). -- cgit v1.2.3