diff options
Diffstat (limited to 'operations')
-rw-r--r-- | operations/add_comment.go | 12 | ||||
-rw-r--r-- | operations/create.go | 12 | ||||
-rw-r--r-- | operations/label_change.go | 4 | ||||
-rw-r--r-- | operations/operations.go | 14 | ||||
-rw-r--r-- | operations/set_status.go | 2 | ||||
-rw-r--r-- | operations/set_title.go | 4 |
6 files changed, 25 insertions, 23 deletions
diff --git a/operations/add_comment.go b/operations/add_comment.go index 24fa2696..8c4b8b9c 100644 --- a/operations/add_comment.go +++ b/operations/add_comment.go @@ -11,16 +11,16 @@ var _ bug.Operation = AddCommentOperation{} type AddCommentOperation struct { bug.OpBase - Message string + Message string `json:"message"` // TODO: change for a map[string]util.hash to store the filename ? - files []git.Hash + Files []git.Hash `json:"files"` } func (op AddCommentOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { comment := bug.Comment{ Message: op.Message, Author: op.Author, - Files: op.files, + Files: op.Files, UnixTime: op.UnixTime, } @@ -29,15 +29,15 @@ func (op AddCommentOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { return snapshot } -func (op AddCommentOperation) Files() []git.Hash { - return op.files +func (op AddCommentOperation) GetFiles() []git.Hash { + return op.Files } func NewAddCommentOp(author bug.Person, message string, files []git.Hash) AddCommentOperation { return AddCommentOperation{ OpBase: bug.NewOpBase(bug.AddCommentOp, author), Message: message, - files: files, + Files: files, } } diff --git a/operations/create.go b/operations/create.go index 81e5af93..a671171e 100644 --- a/operations/create.go +++ b/operations/create.go @@ -11,9 +11,9 @@ var _ bug.Operation = CreateOperation{} type CreateOperation struct { bug.OpBase - Title string - Message string - files []git.Hash + Title string `json:"title"` + Message string `json:"message"` + Files []git.Hash `json:"files"` } func (op CreateOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { @@ -30,8 +30,8 @@ func (op CreateOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { return snapshot } -func (op CreateOperation) Files() []git.Hash { - return op.files +func (op CreateOperation) GetFiles() []git.Hash { + return op.Files } func NewCreateOp(author bug.Person, title, message string, files []git.Hash) CreateOperation { @@ -39,7 +39,7 @@ func NewCreateOp(author bug.Person, title, message string, files []git.Hash) Cre OpBase: bug.NewOpBase(bug.CreateOp, author), Title: title, Message: message, - files: files, + Files: files, } } diff --git a/operations/label_change.go b/operations/label_change.go index 551b8be0..26e7e94c 100644 --- a/operations/label_change.go +++ b/operations/label_change.go @@ -14,8 +14,8 @@ var _ bug.Operation = LabelChangeOperation{} // LabelChangeOperation define a Bug operation to add or remove labels type LabelChangeOperation struct { bug.OpBase - Added []bug.Label - Removed []bug.Label + Added []bug.Label `json:"added"` + Removed []bug.Label `json:"removed"` } // Apply apply the operation diff --git a/operations/operations.go b/operations/operations.go index 0bfd3b84..348f8cc8 100644 --- a/operations/operations.go +++ b/operations/operations.go @@ -1,12 +1,14 @@ package operations -import "encoding/gob" +import ( + "github.com/MichaelMure/git-bug/bug" +) // Package initialisation used to register operation's type for (de)serialization func init() { - gob.Register(AddCommentOperation{}) - gob.Register(CreateOperation{}) - gob.Register(SetTitleOperation{}) - gob.Register(SetStatusOperation{}) - gob.Register(LabelChangeOperation{}) + bug.Register(bug.CreateOp, CreateOperation{}) + bug.Register(bug.SetTitleOp, SetTitleOperation{}) + bug.Register(bug.AddCommentOp, AddCommentOperation{}) + bug.Register(bug.SetStatusOp, SetStatusOperation{}) + bug.Register(bug.LabelChangeOp, LabelChangeOperation{}) } diff --git a/operations/set_status.go b/operations/set_status.go index bafcf5ee..37ebac10 100644 --- a/operations/set_status.go +++ b/operations/set_status.go @@ -10,7 +10,7 @@ var _ bug.Operation = SetStatusOperation{} type SetStatusOperation struct { bug.OpBase - Status bug.Status + Status bug.Status `json:"status"` } func (op SetStatusOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { diff --git a/operations/set_title.go b/operations/set_title.go index 5bd6260a..7aa76268 100644 --- a/operations/set_title.go +++ b/operations/set_title.go @@ -10,8 +10,8 @@ var _ bug.Operation = SetTitleOperation{} type SetTitleOperation struct { bug.OpBase - Title string - Was string + Title string `json:"title"` + Was string `json:"was"` } func (op SetTitleOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { |