mandy

package
v0.0.0-...-47a2fa7 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const AOSPA_BRANCH = "quartz"
View Source
const AOSPA_MANIFEST_NAME = "manifest"
View Source
const AOSPA_MANIFEST_URL = GITHUB_HTTP + "/AOSPA/manifest.git"
View Source
const CAF_BRANCH = "caf"
View Source
const GERRIT_URL = "ssh://" + MANDY_USERNAME + "@gerrit.aospa.co:29418"
View Source
const GITHUB_HTTP = "git://github.com"
View Source
const MANDY_BRANCH = AOSPA_BRANCH + "-bot"
View Source
const MANDY_EMAIL = "mergebot@aospa.co"
View Source
const MANDY_NAME = "Mergebot"
View Source
const MANDY_TAG = "Mandy"
View Source
const MANDY_USERNAME = "PAMergebot"
View Source
const MANIFEST_AOSPA = "manifests/aospa.xml"
View Source
const MANIFEST_DEFAULT = "default.xml"

Variables

This section is empty.

Functions

func GetRevision

func GetRevision(project Project, manifest Manifest) (string, error)

Types

type AospaProject

type AospaProject struct {
	Path string `json:"-"`

	Name       string `json:"name"`
	LatestTag  string `json:"latesttag"`
	Conflicted bool   `json:"conflicted"`
	// contains filtered or unexported fields
}

type Data

type Data struct {
	Code         int         `json:"code"`
	BelongToUser string      `json:"belongto,omitempty"`
	Data         interface{} `json:"data"`
	Date         string      `json:"date"`
}

type Defaults

type Defaults struct {
	Revision string `xml:"revision,attr"`
	Remote   string `xml:"remote,attr"`
}

type MandyErr

type MandyErr string

func (MandyErr) Error

func (e MandyErr) Error() string

type MandyErrorCode

type MandyErrorCode int
const CODE_API_INVALID MandyErrorCode = 2
const CODE_GET_NOTIFICATION_ACTIVITIES_FAILED MandyErrorCode = 15
const CODE_GET_USERS_FAILED MandyErrorCode = 12
const CODE_MERGE_FAILED MandyErrorCode = 8
const CODE_NO_ERROR MandyErrorCode = 0
const CODE_PASSWORD_SHORT MandyErrorCode = 4
const CODE_REMOVE_USER_FAILED MandyErrorCode = 14
const CODE_REVERT_FAILED MandyErrorCode = 10
const CODE_SET_CONFLICTION_FAILED MandyErrorCode = 9
const CODE_SET_MODERATION_FAILED MandyErrorCode = 13
const CODE_SET_VERIFICATION_FAILED MandyErrorCode = 13
const CODE_SUBMIT_FAILED MandyErrorCode = 11
const CODE_UNKNOWN_ERROR MandyErrorCode = 1
const CODE_USERNAME_PASSWORD_INVALID MandyErrorCode = 7
const CODE_USERNAME_SHORT MandyErrorCode = 5
const CODE_USERNAME_TAKEN MandyErrorCode = 3

type MandyNotification

type MandyNotification int
const NOTIFICATION_MERGEABLE MandyNotification = 2
const NOTIFICATION_MERGED MandyNotification = 4
const NOTIFICATION_MERGING MandyNotification = 3
const NOTIFICATION_NEW_TAG_FOUND MandyNotification = 1
const NOTIFICATION_REVERTED MandyNotification = 6
const NOTIFICATION_REVERTING MandyNotification = 5
const NOTIFICATION_SUBMITTED MandyNotification = 8
const NOTIFICATION_SUBMITTING MandyNotification = 7
const NOTIFICATION_VERIFIED MandyNotification = 0

type MandyStatus

type MandyStatus struct {
	ManifestTag string `json:"manifesttag"`

	LatestTag     string          `json:"latesttag"`
	AospaProjects []*AospaProject `json:"projects"`

	Mergeable bool `json:"mergeable"`
	Merging   bool `json:"merging"`
	Merged    bool `json:"merged"`
	Merger    User `json:"merger"`

	Submittable bool `json:"submittable"`
	Submitting  bool `json:"submitting"`
	Submitted   bool `json:"submitted"`
	Submitter   User `json:"submitter"`

	Reverting bool `json:"reverting"`
	Reverter  User `json:"reverter"`

	Notification *Notification `json:"-"`
	// contains filtered or unexported fields
}

func MandyInit

func MandyInit(initialize bool, firebaseApiKey string, userdata *UserData) *MandyStatus

func (*MandyStatus) Kill

func (mandyStatus *MandyStatus) Kill()

func (*MandyStatus) Revert

func (mandyStatus *MandyStatus) Revert(user *User) error

func (*MandyStatus) SetConflicted

func (mandyStatus *MandyStatus) SetConflicted(name string, conflicted bool)

func (*MandyStatus) StartMerging

func (mandyStatus *MandyStatus) StartMerging(user *User) error

func (*MandyStatus) Strip

func (mandyStatus *MandyStatus) Strip() MandyStatus

func (*MandyStatus) Submit

func (mandyStatus *MandyStatus) Submit(user *User) error

type Manifest

type Manifest struct {
	XMLName        xml.Name        `xml:"manifest"`
	Remotes        []Remote        `xml:"remote"`
	Defaults       Defaults        `xml:"default"`
	Projects       []Project       `xml:"project"`
	RemoveProjects []RemoveProject `xml:"remove-project"`
}

func NewManifest

func NewManifest(data []byte) (Manifest, error)

type ManifestErr

type ManifestErr string

func (ManifestErr) Error

func (e ManifestErr) Error() string

type Notification

type Notification struct {
	Activities []Data
	// contains filtered or unexported fields
}

func NewNotification

func NewNotification(firebaseApiKey string, userdata *UserData) *Notification

func (*Notification) Notify

func (notification *Notification) Notify(notificationCode MandyNotification, data interface{}, users ...*User)

type Project

type Project struct {
	Name     string `xml:"name,attr"`
	Path     string `xml:"path,attr"`
	Remote   string `xml:"remote,attr"`
	Revision string `xml:"revision,attr"`
}

type Remote

type Remote struct {
	Name     string `xml:"name,attr"`
	Fetch    string `xml:"fetch,attr"`
	Revision string `xml:"revision,attr"`
}

func FindRemoteByName

func FindRemoteByName(name string, manifest Manifest) (Remote, error)

type RemoveProject

type RemoveProject struct {
	Name string `xml:"name,attr"`
}

type User

type User struct {
	ApiToken    string   `json:"apitoken,omitempty"`
	Name        string   `json:"name"`
	Password    string   `json:"password,omitempty"`
	Salt        string   `json:"salt,omitempty"`
	Hash        string   `json:"hash,omitempty"`
	Admin       bool     `json:"admin"`
	Moderator   bool     `json:"moderator"`
	Verified    bool     `json:"verified"`
	FirebaseKey []string `json:"firebasekey,omitempty"`
}

func NewUser

func NewUser(j []byte) (*User, error)

func (*User) HardStrip

func (user *User) HardStrip() User

func (*User) Strip

func (user *User) Strip() User

func (User) ToJson

func (user User) ToJson() string

type UserData

type UserData struct {
	// contains filtered or unexported fields
}

func NewUserData

func NewUserData() *UserData

func (*UserData) FindUserByApi

func (userdata *UserData) FindUserByApi(api string) *User

func (*UserData) GetUserWithPassword

func (userdata *UserData) GetUserWithPassword(user *User) (User, MandyErrorCode)

func (*UserData) GetUsers

func (userdata *UserData) GetUsers() []*User

func (*UserData) GetVerifiedUsers

func (userdata *UserData) GetVerifiedUsers() []*User

func (*UserData) InsertUser

func (userdata *UserData) InsertUser(user *User) (User, MandyErrorCode)

func (*UserData) Moderator

func (userdata *UserData) Moderator(requester *User, user string, moderator bool) (*User, error)

func (*UserData) Remove

func (userdata *UserData) Remove(requester *User, user string) error

func (*UserData) UpdateFirebaseKey

func (userdata *UserData) UpdateFirebaseKey(apiToken string, keys []string) error

func (*UserData) UpdateUser

func (userdata *UserData) UpdateUser(user *User)

func (*UserData) Verify

func (userdata *UserData) Verify(requester *User, user string, verified bool) (*User, error)

type UserDataErr

type UserDataErr string

func (UserDataErr) Error

func (e UserDataErr) Error() string

Jump to

Keyboard shortcuts

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