@@ -12,6 +12,7 @@ import (
12
12
"golang.org/x/build/gerrit"
13
13
)
14
14
15
+ // Person represents a person.
15
16
type Person struct {
16
17
Name string // "Foo Bar"
17
18
Github string // "FooBar" (orig case, no '@')
@@ -63,10 +64,27 @@ func (p *Person) mergeIDs(ids ...string) {
63
64
// keys are "@lowercasegithub", "lowercase name", "[email protected] ".
64
65
var idToPerson = map [string ]* Person {}
65
66
67
+ // GetPerson looks up a person by id and returns one if found,
68
+ // or nil otherwise.
69
+ //
70
+ // The id is case insensitive, and may be one of:
71
+ //
72
+ // • full name (for example, "Dmitri Shuralyov")
73
+ //
74
+ // • GitHub username (for example, "@dmitshur"), leading '@' is mandatory
75
+ //
76
+ // • Gerrit <account ID>@<instance ID> (for example, "6005@62eb7196-b449-3ce5-99f1-c037f21e1705")
77
+ //
78
+ // • email (for example, "[email protected] ")
79
+ //
80
+ // Only exact matches are supported.
81
+ //
66
82
func GetPerson (id string ) * Person {
67
83
return idToPerson [strings .ToLower (id )]
68
84
}
69
85
86
+ // GetGerritPerson looks up a person from the Gerrit account ai.
87
+ // It uses the name and email in the Gerrit account for the lookup.
70
88
func GetGerritPerson (ai gerrit.AccountInfo ) * Person {
71
89
if p := GetPerson (ai .Name ); p != nil {
72
90
return p
0 commit comments