File: common.go

package info (click to toggle)
lazygit 0.57.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,748 kB
  • sloc: sh: 153; makefile: 76
file content (92 lines) | stat: -rw-r--r-- 2,274 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package components

import "fmt"

// for running common actions
type Common struct {
	t *TestDriver
}

func (self *Common) ContinueMerge() {
	self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)

	self.t.ExpectPopup().Menu().
		Title(Equals("Rebase options")).
		Select(Contains("continue")).
		Confirm()
}

func (self *Common) ContinueRebase() {
	self.ContinueMerge()
}

func (self *Common) AbortRebase() {
	self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)

	self.t.ExpectPopup().Menu().
		Title(Equals("Rebase options")).
		Select(Contains("abort")).
		Confirm()
}

func (self *Common) AbortMerge() {
	self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)

	self.t.ExpectPopup().Menu().
		Title(Equals("Merge options")).
		Select(Contains("abort")).
		Confirm()
}

func (self *Common) AcknowledgeConflicts() {
	self.t.ExpectPopup().Menu().
		Title(Equals("Conflicts!")).
		Select(Contains("View conflicts")).
		Confirm()
}

func (self *Common) ContinueOnConflictsResolved(command string) {
	self.t.ExpectPopup().Confirmation().
		Title(Equals("Continue")).
		Content(Contains(fmt.Sprintf("All merge conflicts resolved. Continue the %s?", command))).
		Confirm()
}

func (self *Common) ConfirmDiscardLines() {
	self.t.ExpectPopup().Confirmation().
		Title(Equals("Discard change")).
		Content(Contains("Are you sure you want to discard this change")).
		Confirm()
}

func (self *Common) SelectPatchOption(matcher *TextMatcher) {
	self.t.GlobalPress(self.t.keys.Universal.CreatePatchOptionsMenu)

	self.t.ExpectPopup().Menu().Title(Equals("Patch options")).Select(matcher).Confirm()
}

func (self *Common) ResetBisect() {
	self.t.Views().Commits().
		Focus().
		Press(self.t.keys.Commits.ViewBisectOptions).
		Tap(func() {
			self.t.ExpectPopup().Menu().
				Title(Equals("Bisect")).
				Select(Contains("Reset bisect")).
				Confirm()

			self.t.ExpectPopup().Confirmation().
				Title(Equals("Reset 'git bisect'")).
				Content(Contains("Are you sure you want to reset 'git bisect'?")).
				Confirm()
		})
}

func (self *Common) ResetCustomPatch() {
	self.t.GlobalPress(self.t.keys.Universal.CreatePatchOptionsMenu)

	self.t.ExpectPopup().Menu().
		Title(Equals("Patch options")).
		Select(Contains("Reset patch")).
		Confirm()
}