aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-15 15:09:49 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-25 10:12:41 +0100
commit76280ee7ce2ebc67e633381930ef8409046aba99 (patch)
tree462130c2a9abecf12b53f41d7a5d570ec2667fcc /pkg/vcs
parent5b90407edc5f3cd1eaf9e5667b96f8e155fe0118 (diff)
pkg/vcs: reorder code
Recipients is not the most importnat part of the vcs interface, move it from the very top closer to the bottom.
Diffstat (limited to 'pkg/vcs')
-rw-r--r--pkg/vcs/vcs.go100
1 files changed, 50 insertions, 50 deletions
diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go
index e698867a4..d86e15f62 100644
--- a/pkg/vcs/vcs.go
+++ b/pkg/vcs/vcs.go
@@ -19,56 +19,6 @@ import (
"github.com/google/syzkaller/sys/targets"
)
-type RecipientType int
-
-const (
- To RecipientType = iota
- Cc
-)
-
-func (t RecipientType) String() string {
- return [...]string{"To", "Cc"}[t]
-}
-
-type RecipientInfo struct {
- Address mail.Address
- Type RecipientType
-}
-
-type Recipients []RecipientInfo
-
-func (r Recipients) GetEmails(filter RecipientType) []string {
- emails := []string{}
- for _, user := range r {
- if user.Type == filter {
- emails = append(emails, user.Address.Address)
- }
- }
- sort.Strings(emails)
- return emails
-}
-
-func NewRecipients(emails []string, t RecipientType) Recipients {
- r := Recipients{}
- for _, e := range emails {
- r = append(r, RecipientInfo{mail.Address{Address: e}, t})
- }
- sort.Sort(r)
- return r
-}
-
-func (r Recipients) Len() int { return len(r) }
-func (r Recipients) Less(i, j int) bool { return r[i].Address.Address < r[j].Address.Address }
-func (r Recipients) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
-
-func (r Recipients) ToDash() dashapi.Recipients {
- d := dashapi.Recipients{}
- for _, user := range r {
- d = append(d, dashapi.RecipientInfo{Address: user.Address, Type: dashapi.RecipientType(user.Type)})
- }
- return d
-}
-
type Repo interface {
// Poll checkouts the specified repository/branch.
// This involves fetching/resetting/cloning as necessary to recover from all possible problems.
@@ -148,6 +98,56 @@ type Commit struct {
CommitDate time.Time
}
+type RecipientType int
+
+const (
+ To RecipientType = iota
+ Cc
+)
+
+func (t RecipientType) String() string {
+ return [...]string{"To", "Cc"}[t]
+}
+
+type RecipientInfo struct {
+ Address mail.Address
+ Type RecipientType
+}
+
+type Recipients []RecipientInfo
+
+func (r Recipients) GetEmails(filter RecipientType) []string {
+ emails := []string{}
+ for _, user := range r {
+ if user.Type == filter {
+ emails = append(emails, user.Address.Address)
+ }
+ }
+ sort.Strings(emails)
+ return emails
+}
+
+func NewRecipients(emails []string, t RecipientType) Recipients {
+ r := Recipients{}
+ for _, e := range emails {
+ r = append(r, RecipientInfo{mail.Address{Address: e}, t})
+ }
+ sort.Sort(r)
+ return r
+}
+
+func (r Recipients) Len() int { return len(r) }
+func (r Recipients) Less(i, j int) bool { return r[i].Address.Address < r[j].Address.Address }
+func (r Recipients) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
+
+func (r Recipients) ToDash() dashapi.Recipients {
+ d := dashapi.Recipients{}
+ for _, user := range r {
+ d = append(d, dashapi.RecipientInfo{Address: user.Address, Type: dashapi.RecipientType(user.Type)})
+ }
+ return d
+}
+
type BisectResult int
const (