interactive_rebase

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Amends a staged file to a merge commit.",
	ExtraCmdArgs: "",
	Skip:         false,
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shell.
			NewBranch("development-branch").
			CreateFileAndAdd("initial-file", "initial file content").
			Commit("initial commit").
			NewBranch("feature-branch").
			CreateFileAndAdd("new-feature-file", "new content").
			Commit("new feature commit").
			Checkout("development-branch").
			Merge("feature-branch").
			CreateFileAndAdd(postMergeFilename, postMergeFileContent)
	},
	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
		assert.CommitCount(3)

		input.SwitchToCommitsWindow()
		assert.CurrentViewName("commits")

		mergeCommitMessage := "Merge branch 'feature-branch' into development-branch"
		assert.MatchHeadCommitMessage(Contains(mergeCommitMessage))

		input.PressKeys(keys.Commits.AmendToCommit)
		input.ProceedWhenAsked(Contains("Are you sure you want to amend this commit with your staged files?"))

		assert.CommitCount(3)
		assert.MatchHeadCommitMessage(Contains(mergeCommitMessage))

		assert.MatchMainViewContent(Contains(postMergeFilename))
		assert.MatchMainViewContent(Contains("++" + postMergeFileContent))
	},
})
View Source
var One = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Begins an interactive rebase, then fixups, drops, and squashes some commits",
	ExtraCmdArgs: "",
	Skip:         false,
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shell.
			CreateNCommits(5)
	},
	Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
		input.SwitchToCommitsWindow()
		assert.CurrentViewName("commits")

		input.NavigateToListItemContainingText("commit 02")
		input.PressKeys(keys.Universal.Edit)
		assert.MatchSelectedLine(Contains("YOU ARE HERE"))

		input.PreviousItem()
		input.PressKeys(keys.Commits.MarkCommitAsFixup)
		assert.MatchSelectedLine(Contains("fixup"))

		input.PreviousItem()
		input.PressKeys(keys.Universal.Remove)
		assert.MatchSelectedLine(Contains("drop"))

		input.PreviousItem()
		input.PressKeys(keys.Commits.SquashDown)
		assert.MatchSelectedLine(Contains("squash"))

		input.ContinueRebase()

		assert.CommitCount(2)
	},
})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL