blob: 87ca14bf5027975b05f744a9adbe62f7a1c12f5a (
plain) (
blame)
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
|
package operations
import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/util"
)
// SetStatusOperation will change the status of a bug
var _ bug.Operation = SetStatusOperation{}
type SetStatusOperation struct {
bug.OpBase
Status bug.Status
}
func (op SetStatusOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
snapshot.Status = op.Status
return snapshot
}
func (op SetStatusOperation) Files() []util.Hash {
return nil
}
func NewSetStatusOp(author bug.Person, status bug.Status) SetStatusOperation {
return SetStatusOperation{
OpBase: bug.NewOpBase(bug.SetStatusOp, author),
Status: status,
}
}
// Convenience function to apply the operation
func Open(b *bug.Bug, author bug.Person) {
op := NewSetStatusOp(author, bug.OpenStatus)
b.Append(op)
}
// Convenience function to apply the operation
func Close(b *bug.Bug, author bug.Person) {
op := NewSetStatusOp(author, bug.ClosedStatus)
b.Append(op)
}
|