mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-04 03:48:07 +02:00
migrate undo2
This commit is contained in:
parent
9e1e20fef2
commit
ac580ae6a0
@ -85,5 +85,6 @@ var tests = []*components.IntegrationTest{
|
||||
sync.Pull,
|
||||
sync.PullAndSetUpstream,
|
||||
sync.RenameBranchAndPull,
|
||||
undo.UndoCheckoutAndDrop,
|
||||
undo.UndoDrop,
|
||||
}
|
||||
|
151
pkg/integration/tests/undo/undo_checkout_and_drop.go
Normal file
151
pkg/integration/tests/undo/undo_checkout_and_drop.go
Normal file
@ -0,0 +1,151 @@
|
||||
package undo
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var UndoCheckoutAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Drop some commits and then undo/redo the actions",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.EmptyCommit("two")
|
||||
shell.EmptyCommit("three")
|
||||
shell.EmptyCommit("four")
|
||||
|
||||
shell.NewBranch("other_branch")
|
||||
shell.Checkout("master")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
// we're going to drop a commit, switch branch, drop a commit there, then undo everything, then redo everything.
|
||||
|
||||
confirmCommitDrop := func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Delete Commit")).
|
||||
Content(Equals("Are you sure you want to delete this commit?")).
|
||||
Confirm()
|
||||
}
|
||||
|
||||
confirmUndoDrop := func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Undo")).
|
||||
Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)).
|
||||
Confirm()
|
||||
}
|
||||
|
||||
confirmRedoDrop := func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Redo")).
|
||||
Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)).
|
||||
Confirm()
|
||||
}
|
||||
|
||||
t.Views().Commits().Focus().
|
||||
Lines(
|
||||
Contains("four").IsSelected(),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(confirmCommitDrop).
|
||||
Lines(
|
||||
Contains("three").IsSelected(),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
)
|
||||
|
||||
t.Views().Branches().Focus().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
Contains("other_branch"),
|
||||
).
|
||||
SelectNextItem().
|
||||
// checkout branch
|
||||
PressPrimaryAction().
|
||||
Lines(
|
||||
Contains("other_branch").IsSelected(),
|
||||
Contains("master"),
|
||||
)
|
||||
|
||||
// drop the commit in the 'other_branch' branch too
|
||||
t.Views().Commits().Focus().
|
||||
Lines(
|
||||
Contains("four").IsSelected(),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(confirmCommitDrop).
|
||||
Lines(
|
||||
Contains("three").IsSelected(),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Undo).
|
||||
Tap(confirmUndoDrop).
|
||||
Lines(
|
||||
Contains("four").IsSelected(),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Undo).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Undo")).
|
||||
Content(Contains("Are you sure you want to checkout 'master'?")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Branches().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
Contains("other_branch"),
|
||||
)
|
||||
}).
|
||||
Lines(
|
||||
Contains("three").IsSelected(),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Undo).
|
||||
Tap(confirmUndoDrop).
|
||||
Lines(
|
||||
Contains("four").IsSelected(),
|
||||
Contains("three"),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Redo).
|
||||
Tap(confirmRedoDrop).
|
||||
Lines(
|
||||
Contains("three").IsSelected(),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
).
|
||||
Press(keys.Universal.Redo).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Redo")).
|
||||
Content(Contains("Are you sure you want to checkout 'other_branch'?")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Branches().
|
||||
Lines(
|
||||
Contains("other_branch").IsSelected(),
|
||||
Contains("master"),
|
||||
)
|
||||
}).
|
||||
Press(keys.Universal.Redo).
|
||||
Tap(confirmRedoDrop).
|
||||
Lines(
|
||||
Contains("three").IsSelected(),
|
||||
Contains("two"),
|
||||
Contains("one"),
|
||||
)
|
||||
},
|
||||
})
|
@ -1 +0,0 @@
|
||||
file2
|
@ -1 +0,0 @@
|
||||
ref: refs/heads/master
|
@ -1 +0,0 @@
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e
|
@ -1,10 +0,0 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
@ -1 +0,0 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
.DS_Store
|
@ -1,28 +0,0 @@
|
||||
0000000000000000000000000000000000000000 8d31a10ce1a1a1606ab02e8a2a59a6c56808f7c5 CI <CI@example.com> 1617683460 +1000 commit (initial): file0
|
||||
8d31a10ce1a1a1606ab02e8a2a59a6c56808f7c5 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683460 +1000 commit: file1
|
||||
0e2680a41392859e5159716b50525850017c6a59 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683460 +1000 commit: file2
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683460 +1000 checkout: moving from master to branch2
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683460 +1000 commit: file2
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683461 +1000 checkout: moving from branch2 to master
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683462 +1000 rebase -i (start): checkout bce6c0c795a3d37c0a2c382a6d9c146b1889f86c
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683462 +1000 rebase -i (finish): returning to refs/heads/master
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683463 +1000 rebase -i (start): checkout 0e2680a41392859e5159716b50525850017c6a59
|
||||
0e2680a41392859e5159716b50525850017c6a59 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683463 +1000 rebase -i (finish): returning to refs/heads/master
|
||||
0e2680a41392859e5159716b50525850017c6a59 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683464 +1000 checkout: moving from master to branch2
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683465 +1000 rebase -i (start): checkout e51d8e24ead991fdd7fd9b9d90924c2e24576981
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683465 +1000 rebase -i (finish): returning to refs/heads/branch2
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683466 +1000 rebase -i (start): checkout 481ce2cf9d037b83acb1d452973695764bf7b95e
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683466 +1000 rebase -i (finish): returning to refs/heads/branch2
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683466 +1000 [lazygit undo]: updating HEAD
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683467 +1000 [lazygit undo]: updating HEAD
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683467 +1000 [lazygit undo]
|
||||
0e2680a41392859e5159716b50525850017c6a59 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683468 +1000 [lazygit undo]: updating HEAD
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683468 +1000 [lazygit undo]: updating HEAD
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683469 +1000 [lazygit undo]
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683470 +1000 [lazygit undo]: updating HEAD
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683470 +1000 [lazygit undo]: updating HEAD
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683471 +1000 [lazygit undo]: updating HEAD
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683471 +1000 [lazygit undo]
|
@ -1,11 +0,0 @@
|
||||
0000000000000000000000000000000000000000 a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683460 +1000 branch: Created from HEAD
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683460 +1000 commit: file2
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683465 +1000 rebase -i (finish): refs/heads/branch2 onto e51d8e24ead991fdd7fd9b9d90924c2e24576981
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683466 +1000 rebase -i (finish): refs/heads/branch2 onto 481ce2cf9d037b83acb1d452973695764bf7b95e
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683466 +1000 [lazygit undo]: updating HEAD
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 df1876c035ade1ba199afadd399a6d4273190cd8 CI <CI@example.com> 1617683467 +1000 [lazygit undo]: updating HEAD
|
||||
df1876c035ade1ba199afadd399a6d4273190cd8 e51d8e24ead991fdd7fd9b9d90924c2e24576981 CI <CI@example.com> 1617683470 +1000 [lazygit undo]: updating HEAD
|
||||
e51d8e24ead991fdd7fd9b9d90924c2e24576981 481ce2cf9d037b83acb1d452973695764bf7b95e CI <CI@example.com> 1617683470 +1000 [lazygit undo]: updating HEAD
|
||||
481ce2cf9d037b83acb1d452973695764bf7b95e a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683471 +1000 [lazygit undo]: updating HEAD
|
@ -1,8 +0,0 @@
|
||||
0000000000000000000000000000000000000000 8d31a10ce1a1a1606ab02e8a2a59a6c56808f7c5 CI <CI@example.com> 1617683460 +1000 commit (initial): file0
|
||||
8d31a10ce1a1a1606ab02e8a2a59a6c56808f7c5 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683460 +1000 commit: file1
|
||||
0e2680a41392859e5159716b50525850017c6a59 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683460 +1000 commit: file2
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683460 +1000 commit: file4
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683462 +1000 rebase -i (finish): refs/heads/master onto bce6c0c795a3d37c0a2c382a6d9c146b1889f86c
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c 0e2680a41392859e5159716b50525850017c6a59 CI <CI@example.com> 1617683463 +1000 rebase -i (finish): refs/heads/master onto 0e2680a41392859e5159716b50525850017c6a59
|
||||
0e2680a41392859e5159716b50525850017c6a59 bce6c0c795a3d37c0a2c382a6d9c146b1889f86c CI <CI@example.com> 1617683468 +1000 [lazygit undo]: updating HEAD
|
||||
bce6c0c795a3d37c0a2c382a6d9c146b1889f86c a3bf51bf610771f997de1d3f313ab7c43e20bef5 CI <CI@example.com> 1617683468 +1000 [lazygit undo]: updating HEAD
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x�Ž;
|
||||
Ã0@;ûÞEòG¶¡”B¦C‘eHš\èñ›#tyÃã
O¶u�»Åâ.ýPµ‰(,Ì®zj“$.±U¯Î…( ÙùÐw·¹zdÑ“ŒÄ8Íì8&‰”!·$Ñ𧿶ã½ãS¿¼î‹Þd[ eìÀœöœêúgnÚ¼(šŸ9�
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x�־A
|
||||
ֳ @ׁ®=…�B™qװI ”BV9ֶ¨#
ִ&=~s„n?oסףײ�ׂ-�מׂU;¨ֿ r ±נ’xן�„ה@Y4
¢Dלָלrט»[¡T¦˜±�#ֵB•�$qצ₪’ײ`ה׃_�a§��§ש©_i�×·¼µ‡ֵˆעלְ�ץ�ךת'7uYױ›ֳn:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
x+)JMU03c040031QHヒフI5`ーアコイ燹ヨカwチ�w.ス��モ[H
|
||||
矢y�5�来ミ(桍ァ^-ンW(x9
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5
|
@ -1 +0,0 @@
|
||||
a3bf51bf610771f997de1d3f313ab7c43e20bef5
|
@ -1 +0,0 @@
|
||||
test0
|
@ -1 +0,0 @@
|
||||
test1
|
@ -1 +0,0 @@
|
||||
test2
|
@ -1 +0,0 @@
|
||||
line one
|
@ -1 +0,0 @@
|
||||
{"KeyEvents":[{"Timestamp":647,"Mod":0,"Key":259,"Ch":0},{"Timestamp":917,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1245,"Mod":0,"Key":256,"Ch":32},{"Timestamp":1646,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1957,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2205,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2533,"Mod":0,"Key":256,"Ch":100},{"Timestamp":2765,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3141,"Mod":0,"Key":260,"Ch":0},{"Timestamp":3397,"Mod":0,"Key":257,"Ch":0},{"Timestamp":3637,"Mod":0,"Key":258,"Ch":0},{"Timestamp":3933,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4780,"Mod":0,"Key":259,"Ch":0},{"Timestamp":5205,"Mod":0,"Key":256,"Ch":100},{"Timestamp":5405,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5685,"Mod":0,"Key":256,"Ch":100},{"Timestamp":5877,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6277,"Mod":0,"Key":256,"Ch":122},{"Timestamp":6725,"Mod":0,"Key":256,"Ch":122},{"Timestamp":7317,"Mod":0,"Key":256,"Ch":122},{"Timestamp":7845,"Mod":0,"Key":256,"Ch":122},{"Timestamp":8372,"Mod":0,"Key":256,"Ch":122},{"Timestamp":8885,"Mod":0,"Key":256,"Ch":122},{"Timestamp":9469,"Mod":0,"Key":256,"Ch":122},{"Timestamp":10069,"Mod":0,"Key":256,"Ch":122},{"Timestamp":10645,"Mod":0,"Key":256,"Ch":122},{"Timestamp":11189,"Mod":0,"Key":256,"Ch":122},{"Timestamp":12077,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd $1
|
||||
|
||||
git init
|
||||
|
||||
git config user.email "CI@example.com"
|
||||
git config user.name "CI"
|
||||
|
||||
echo test0 > file0
|
||||
git add .
|
||||
git commit -am file0
|
||||
|
||||
echo test1 > file1
|
||||
git add .
|
||||
git commit -am file1
|
||||
|
||||
echo test2 > file2
|
||||
git add .
|
||||
git commit -am file2
|
||||
|
||||
echo "line one" > file4
|
||||
git add .
|
||||
git commit -am file4
|
||||
|
||||
git checkout -b branch2
|
||||
|
||||
echo "line two" >> file4
|
||||
git add .
|
||||
git commit -am file4
|
||||
|
||||
echo "line three" >> file4
|
||||
git add .
|
||||
git commit -am file4
|
||||
|
||||
echo "line two" >> file2
|
||||
git add .
|
||||
git commit -am file2
|
@ -1 +0,0 @@
|
||||
{ "description": "undoing changes in both commits and branches. Skipped because it's failing on CI for some reason", "speed": 10, "skip":true}
|
Loading…
Reference in New Issue
Block a user