aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/graphql/gqlgen.yml1
-rw-r--r--api/graphql/graph/bug.generated.go11
-rw-r--r--api/graphql/graph/operations.generated.go5
-rw-r--r--api/graphql/graph/timeline.generated.go7
-rw-r--r--api/graphql/graph/types.generated.go2
-rw-r--r--api/graphql/models/lazy_bug.go7
-rw-r--r--bridge/github/export.go7
-rw-r--r--bridge/github/import_test.go5
-rw-r--r--bridge/gitlab/export.go7
-rw-r--r--bridge/gitlab/import_test.go5
-rw-r--r--bridge/jira/import.go9
-rw-r--r--cache/bug_excerpt.go3
-rw-r--r--cache/filter.go4
-rw-r--r--commands/ls.go3
-rw-r--r--doc/architecture.md4
-rw-r--r--entities/bug/bug.go3
-rw-r--r--entities/bug/op_set_status.go11
-rw-r--r--entities/bug/op_set_status_test.go3
-rw-r--r--entities/bug/operation_test.go13
-rw-r--r--entities/bug/snapshot.go3
-rw-r--r--entities/common/status.go (renamed from entities/bug/status.go)2
-rw-r--r--go.mod3
-rw-r--r--go.sum2
-rw-r--r--query/parser.go4
-rw-r--r--query/parser_test.go8
-rw-r--r--query/query.go6
-rw-r--r--termui/show_bug.go5
27 files changed, 86 insertions, 57 deletions
diff --git a/api/graphql/gqlgen.yml b/api/graphql/gqlgen.yml
index 4c854426..fbb46db6 100644
--- a/api/graphql/gqlgen.yml
+++ b/api/graphql/gqlgen.yml
@@ -12,6 +12,7 @@ autobind:
- "github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/repository"
- "github.com/MichaelMure/git-bug/entity/dag"
+ - "github.com/MichaelMure/git-bug/entities/common"
- "github.com/MichaelMure/git-bug/entities/bug"
- "github.com/MichaelMure/git-bug/entities/identity"
diff --git a/api/graphql/graph/bug.generated.go b/api/graphql/graph/bug.generated.go
index 77f4fe0b..67af1933 100644
--- a/api/graphql/graph/bug.generated.go
+++ b/api/graphql/graph/bug.generated.go
@@ -14,6 +14,7 @@ import (
"github.com/99designs/gqlgen/graphql"
"github.com/MichaelMure/git-bug/api/graphql/models"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/repository"
"github.com/vektah/gqlparser/v2/ast"
)
@@ -370,9 +371,9 @@ func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.Colle
}
return graphql.Null
}
- res := resTmp.(bug.Status)
+ res := resTmp.(common.Status)
fc.Result = res
- return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋbugᚐStatus(ctx, field.Selections, res)
+ return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋcommonᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Bug_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@@ -2425,13 +2426,13 @@ func (ec *executionContext) marshalNCommentEdge2ᚖgithubᚗcomᚋMichaelMureᚋ
return ec._CommentEdge(ctx, sel, v)
}
-func (ec *executionContext) unmarshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋbugᚐStatus(ctx context.Context, v interface{}) (bug.Status, error) {
- var res bug.Status
+func (ec *executionContext) unmarshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋcommonᚐStatus(ctx context.Context, v interface{}) (common.Status, error) {
+ var res common.Status
err := res.UnmarshalGQL(v)
return res, graphql.ErrorOnPath(ctx, err)
}
-func (ec *executionContext) marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋbugᚐStatus(ctx context.Context, sel ast.SelectionSet, v bug.Status) graphql.Marshaler {
+func (ec *executionContext) marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋcommonᚐStatus(ctx context.Context, sel ast.SelectionSet, v common.Status) graphql.Marshaler {
return v
}
diff --git a/api/graphql/graph/operations.generated.go b/api/graphql/graph/operations.generated.go
index d82fa5d4..39a216f4 100644
--- a/api/graphql/graph/operations.generated.go
+++ b/api/graphql/graph/operations.generated.go
@@ -14,6 +14,7 @@ import (
"github.com/99designs/gqlgen/graphql"
"github.com/MichaelMure/git-bug/api/graphql/models"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/repository"
"github.com/vektah/gqlparser/v2/ast"
@@ -1573,9 +1574,9 @@ func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, fiel
}
return graphql.Null
}
- res := resTmp.(bug.Status)
+ res := resTmp.(common.Status)
fc.Result = res
- return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋbugᚐStatus(ctx, field.Selections, res)
+ return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋcommonᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_SetStatusOperation_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
diff --git a/api/graphql/graph/timeline.generated.go b/api/graphql/graph/timeline.generated.go
index 9d9b85b4..9ad32e0b 100644
--- a/api/graphql/graph/timeline.generated.go
+++ b/api/graphql/graph/timeline.generated.go
@@ -14,6 +14,7 @@ import (
"github.com/99designs/gqlgen/graphql"
"github.com/MichaelMure/git-bug/api/graphql/models"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/repository"
"github.com/vektah/gqlparser/v2/ast"
)
@@ -1419,9 +1420,9 @@ func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, f
}
return graphql.Null
}
- res := resTmp.(bug.Status)
+ res := resTmp.(common.Status)
fc.Result = res
- return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋbugᚐStatus(ctx, field.Selections, res)
+ return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋentitiesᚋcommonᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_SetStatusTimelineItem_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@@ -1991,6 +1992,8 @@ func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.Selection
return graphql.Null
}
return ec._SetStatusTimelineItem(ctx, sel, obj)
+ case bug.SetTitleTimelineItem:
+ return ec._SetTitleTimelineItem(ctx, sel, &obj)
case *bug.SetTitleTimelineItem:
if obj == nil {
return graphql.Null
diff --git a/api/graphql/graph/types.generated.go b/api/graphql/graph/types.generated.go
index d29004e1..9095c7ac 100644
--- a/api/graphql/graph/types.generated.go
+++ b/api/graphql/graph/types.generated.go
@@ -424,6 +424,8 @@ func (ec *executionContext) _Authored(ctx context.Context, sel ast.SelectionSet,
return graphql.Null
}
return ec._SetStatusTimelineItem(ctx, sel, obj)
+ case bug.SetTitleTimelineItem:
+ return ec._SetTitleTimelineItem(ctx, sel, &obj)
case *bug.SetTitleTimelineItem:
if obj == nil {
return graphql.Null
diff --git a/api/graphql/models/lazy_bug.go b/api/graphql/models/lazy_bug.go
index ea21a68d..318fdc99 100644
--- a/api/graphql/models/lazy_bug.go
+++ b/api/graphql/models/lazy_bug.go
@@ -6,6 +6,7 @@ import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
)
@@ -16,7 +17,7 @@ import (
type BugWrapper interface {
Id() entity.Id
LastEdit() time.Time
- Status() bug.Status
+ Status() common.Status
Title() string
Comments() ([]bug.Comment, error)
Labels() []bug.Label
@@ -85,7 +86,7 @@ func (lb *lazyBug) LastEdit() time.Time {
return lb.excerpt.EditTime()
}
-func (lb *lazyBug) Status() bug.Status {
+func (lb *lazyBug) Status() common.Status {
return lb.excerpt.Status
}
@@ -167,7 +168,7 @@ func (l *loadedBug) LastEdit() time.Time {
return l.Snapshot.EditTime()
}
-func (l *loadedBug) Status() bug.Status {
+func (l *loadedBug) Status() common.Status {
return l.Snapshot.Status
}
diff --git a/bridge/github/export.go b/bridge/github/export.go
index fab5c861..447e4342 100644
--- a/bridge/github/export.go
+++ b/bridge/github/export.go
@@ -19,6 +19,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core/auth"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
@@ -688,16 +689,16 @@ func (ge *githubExporter) editCommentGithubIssue(ctx context.Context, gc *rateLi
return commentID, m.UpdateIssueComment.IssueComment.URL, nil
}
-func (ge *githubExporter) updateGithubIssueStatus(ctx context.Context, gc *rateLimitHandlerClient, id string, status bug.Status) error {
+func (ge *githubExporter) updateGithubIssueStatus(ctx context.Context, gc *rateLimitHandlerClient, id string, status common.Status) error {
m := &updateIssueMutation{}
// set state
var state githubv4.IssueState
switch status {
- case bug.OpenStatus:
+ case common.OpenStatus:
state = githubv4.IssueStateOpen
- case bug.ClosedStatus:
+ case common.ClosedStatus:
state = githubv4.IssueStateClosed
default:
panic("unknown bug state")
diff --git a/bridge/github/import_test.go b/bridge/github/import_test.go
index 652d7ca1..5575de98 100644
--- a/bridge/github/import_test.go
+++ b/bridge/github/import_test.go
@@ -13,6 +13,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core/auth"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/repository"
@@ -73,8 +74,8 @@ func TestGithubImporter(t *testing.T) {
bug.NewAddCommentOp(author, 0, "### header\n\n**bold**\n\n_italic_\n\n> with quote\n\n`inline code`\n\n```\nmultiline code\n```\n\n- bulleted\n- list\n\n1. numbered\n1. list\n\n- [ ] task\n- [x] list\n\n@MichaelMure mention\n\n#2 reference issue\n#3 auto-reference issue\n\n![image](https://user-images.githubusercontent.com/294669/56870222-811faf80-6a0c-11e9-8f2c-f0beb686303f.png)", nil),
bug.NewSetTitleOp(author, 0, "complex issue edited", "complex issue"),
bug.NewSetTitleOp(author, 0, "complex issue", "complex issue edited"),
- bug.NewSetStatusOp(author, 0, bug.ClosedStatus),
- bug.NewSetStatusOp(author, 0, bug.OpenStatus),
+ bug.NewSetStatusOp(author, 0, common.ClosedStatus),
+ bug.NewSetStatusOp(author, 0, common.OpenStatus),
},
},
},
diff --git a/bridge/gitlab/export.go b/bridge/gitlab/export.go
index 507b552c..04972455 100644
--- a/bridge/gitlab/export.go
+++ b/bridge/gitlab/export.go
@@ -14,6 +14,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core/auth"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
@@ -469,13 +470,13 @@ func editCommentGitlabIssue(ctx context.Context, gc *gitlab.Client, repositoryID
return err
}
-func updateGitlabIssueStatus(ctx context.Context, gc *gitlab.Client, repositoryID string, issueID int, status bug.Status) error {
+func updateGitlabIssueStatus(ctx context.Context, gc *gitlab.Client, repositoryID string, issueID int, status common.Status) error {
var state string
switch status {
- case bug.OpenStatus:
+ case common.OpenStatus:
state = "reopen"
- case bug.ClosedStatus:
+ case common.ClosedStatus:
state = "close"
default:
panic("unknown bug state")
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go
index 197e2148..d98da4ef 100644
--- a/bridge/gitlab/import_test.go
+++ b/bridge/gitlab/import_test.go
@@ -13,6 +13,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core/auth"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/repository"
@@ -75,8 +76,8 @@ func TestGitlabImport(t *testing.T) {
bug.NewAddCommentOp(author, 0, "### header\n\n**bold**\n\n_italic_\n\n> with quote\n\n`inline code`\n\n```\nmultiline code\n```\n\n- bulleted\n- list\n\n1. numbered\n1. list\n\n- [ ] task\n- [x] list\n\n@MichaelMure mention\n\n#2 reference issue\n#3 auto-reference issue", nil),
bug.NewSetTitleOp(author, 0, "complex issue edited", "complex issue"),
bug.NewSetTitleOp(author, 0, "complex issue", "complex issue edited"),
- bug.NewSetStatusOp(author, 0, bug.ClosedStatus),
- bug.NewSetStatusOp(author, 0, bug.OpenStatus),
+ bug.NewSetStatusOp(author, 0, common.ClosedStatus),
+ bug.NewSetStatusOp(author, 0, common.OpenStatus),
bug.NewLabelChangeOperation(author, 0, []bug.Label{"bug"}, []bug.Label{}),
bug.NewLabelChangeOperation(author, 0, []bug.Label{"critical"}, []bug.Label{}),
bug.NewLabelChangeOperation(author, 0, []bug.Label{}, []bug.Label{"critical"}),
diff --git a/bridge/jira/import.go b/bridge/jira/import.go
index fb551b47..c297abcf 100644
--- a/bridge/jira/import.go
+++ b/bridge/jira/import.go
@@ -13,6 +13,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core/auth"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/util/text"
@@ -516,7 +517,7 @@ func (ji *jiraImporter) ensureChange(repo *cache.RepoCache, b *cache.BugCache, e
statusStr, hasMap := statusMap[item.To]
if hasMap {
switch statusStr {
- case bug.OpenStatus.String():
+ case common.OpenStatus.String():
op, err := b.OpenRaw(
author,
entry.Created.Unix(),
@@ -530,7 +531,7 @@ func (ji *jiraImporter) ensureChange(repo *cache.RepoCache, b *cache.BugCache, e
}
ji.out <- core.NewImportStatusChange(op.Id())
- case bug.ClosedStatus.String():
+ case common.ClosedStatus.String():
op, err := b.CloseRaw(
author,
entry.Created.Unix(),
@@ -608,8 +609,8 @@ func getStatusMap(conf core.Configuration) (map[string]string, error) {
mapStr, hasConf := conf[confKeyIDMap]
if !hasConf {
return map[string]string{
- bug.OpenStatus.String(): "1",
- bug.ClosedStatus.String(): "6",
+ common.OpenStatus.String(): "1",
+ common.ClosedStatus.String(): "6",
}, nil
}
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go
index 94893d11..7e3bcad4 100644
--- a/cache/bug_excerpt.go
+++ b/cache/bug_excerpt.go
@@ -6,6 +6,7 @@ import (
"time"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/util/lamport"
@@ -27,7 +28,7 @@ type BugExcerpt struct {
EditUnixTime int64
AuthorId entity.Id
- Status bug.Status
+ Status common.Status
Labels []bug.Label
Title string
LenComments int
diff --git a/cache/filter.go b/cache/filter.go
index bd2bcfff..299e7c83 100644
--- a/cache/filter.go
+++ b/cache/filter.go
@@ -3,7 +3,7 @@ package cache
import (
"strings"
- "github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/query"
)
@@ -18,7 +18,7 @@ type resolver interface {
type Filter func(excerpt *BugExcerpt, resolver resolver) bool
// StatusFilter return a Filter that match a bug status
-func StatusFilter(status bug.Status) Filter {
+func StatusFilter(status common.Status) Filter {
return func(excerpt *BugExcerpt, resolver resolver) bool {
return excerpt.Status == status
}
diff --git a/commands/ls.go b/commands/ls.go
index 82f994b4..6ec06f39 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -12,6 +12,7 @@ import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/query"
"github.com/MichaelMure/git-bug/util/colors"
)
@@ -379,7 +380,7 @@ func lsOrgmodeFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
// Finish the command flags transformation into the query.Query
func completeQuery(q *query.Query, opts lsOptions) error {
for _, str := range opts.statusQuery {
- status, err := bug.StatusFromString(str)
+ status, err := common.StatusFromString(str)
if err != nil {
return err
}
diff --git a/doc/architecture.md b/doc/architecture.md
index 5d1b2194..5f81462b 100644
--- a/doc/architecture.md
+++ b/doc/architecture.md
@@ -40,7 +40,7 @@ Those interfaces are implemented by `GitRepo` as well as a mock for testing.
## identity
-The package `identity` contains the identity data model and the related low-level functions.
+The package `entities/identity` contains the identity data model and the related low-level functions.
In particular, this package contains:
- `Identity`, the fully-featured identity, holding a series of `Version` stored in its dedicated structure in git
@@ -48,7 +48,7 @@ In particular, this package contains:
## bug
-The package `bug` contains the bug data model and the related low-level functions.
+The package `entities/bug` contains the bug data model and the related low-level functions.
In particular, this package contains:
- `Operation`, the interface to fulfill for an edit operation of a Bug
diff --git a/entities/bug/bug.go b/entities/bug/bug.go
index 213a4ca4..4ce10c5b 100644
--- a/entities/bug/bug.go
+++ b/entities/bug/bug.go
@@ -4,6 +4,7 @@ package bug
import (
"fmt"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
@@ -149,7 +150,7 @@ func (bug *Bug) Operations() []Operation {
func (bug *Bug) Compile() *Snapshot {
snap := &Snapshot{
id: bug.Id(),
- Status: OpenStatus,
+ Status: common.OpenStatus,
}
for _, op := range bug.Operations() {
diff --git a/entities/bug/op_set_status.go b/entities/bug/op_set_status.go
index 5e73d982..cf17901a 100644
--- a/entities/bug/op_set_status.go
+++ b/entities/bug/op_set_status.go
@@ -3,6 +3,7 @@ package bug
import (
"github.com/pkg/errors"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
@@ -14,7 +15,7 @@ var _ Operation = &SetStatusOperation{}
// SetStatusOperation will change the status of a bug
type SetStatusOperation struct {
dag.OpBase
- Status Status `json:"status"`
+ Status common.Status `json:"status"`
}
func (op *SetStatusOperation) Id() entity.Id {
@@ -47,7 +48,7 @@ func (op *SetStatusOperation) Validate() error {
return nil
}
-func NewSetStatusOp(author identity.Interface, unixTime int64, status Status) *SetStatusOperation {
+func NewSetStatusOp(author identity.Interface, unixTime int64, status common.Status) *SetStatusOperation {
return &SetStatusOperation{
OpBase: dag.NewOpBase(SetStatusOp, author, unixTime),
Status: status,
@@ -58,7 +59,7 @@ type SetStatusTimelineItem struct {
id entity.Id
Author identity.Interface
UnixTime timestamp.Timestamp
- Status Status
+ Status common.Status
}
func (s SetStatusTimelineItem) Id() entity.Id {
@@ -70,7 +71,7 @@ func (s SetStatusTimelineItem) IsAuthored() {}
// Open is a convenience function to change a bugs state to Open
func Open(b Interface, author identity.Interface, unixTime int64, metadata map[string]string) (*SetStatusOperation, error) {
- op := NewSetStatusOp(author, unixTime, OpenStatus)
+ op := NewSetStatusOp(author, unixTime, common.OpenStatus)
for key, value := range metadata {
op.SetMetadata(key, value)
}
@@ -83,7 +84,7 @@ func Open(b Interface, author identity.Interface, unixTime int64, metadata map[s
// Close is a convenience function to change a bugs state to Close
func Close(b Interface, author identity.Interface, unixTime int64, metadata map[string]string) (*SetStatusOperation, error) {
- op := NewSetStatusOp(author, unixTime, ClosedStatus)
+ op := NewSetStatusOp(author, unixTime, common.ClosedStatus)
for key, value := range metadata {
op.SetMetadata(key, value)
}
diff --git a/entities/bug/op_set_status_test.go b/entities/bug/op_set_status_test.go
index 7ec78704..5bb30265 100644
--- a/entities/bug/op_set_status_test.go
+++ b/entities/bug/op_set_status_test.go
@@ -3,12 +3,13 @@ package bug
import (
"testing"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity/dag"
)
func TestSetStatusSerialize(t *testing.T) {
dag.SerializeRoundTripTest(t, func(author identity.Interface, unixTime int64) *SetStatusOperation {
- return NewSetStatusOp(author, unixTime, ClosedStatus)
+ return NewSetStatusOp(author, unixTime, common.ClosedStatus)
})
}
diff --git a/entities/bug/operation_test.go b/entities/bug/operation_test.go
index fe8080c3..4bec49ae 100644
--- a/entities/bug/operation_test.go
+++ b/entities/bug/operation_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity/dag"
"github.com/MichaelMure/git-bug/repository"
@@ -30,7 +31,7 @@ func TestValidate(t *testing.T) {
NewCreateOp(rene, unix, "title", "message", nil),
NewSetTitleOp(rene, unix, "title2", "title1"),
NewAddCommentOp(rene, unix, "message2", nil),
- NewSetStatusOp(rene, unix, ClosedStatus),
+ NewSetStatusOp(rene, unix, common.ClosedStatus),
NewLabelChangeOperation(rene, unix, []Label{"added"}, []Label{"removed"}),
}
@@ -42,11 +43,11 @@ func TestValidate(t *testing.T) {
bad := []Operation{
// opbase
- NewSetStatusOp(makeIdentity(t, "", "rene@descartes.fr"), unix, ClosedStatus),
- NewSetStatusOp(makeIdentity(t, "René Descartes\u001b", "rene@descartes.fr"), unix, ClosedStatus),
- NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@descartes.fr\u001b"), unix, ClosedStatus),
- NewSetStatusOp(makeIdentity(t, "René \nDescartes", "rene@descartes.fr"), unix, ClosedStatus),
- NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@\ndescartes.fr"), unix, ClosedStatus),
+ NewSetStatusOp(makeIdentity(t, "", "rene@descartes.fr"), unix, common.ClosedStatus),
+ NewSetStatusOp(makeIdentity(t, "René Descartes\u001b", "rene@descartes.fr"), unix, common.ClosedStatus),
+ NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@descartes.fr\u001b"), unix, common.ClosedStatus),
+ NewSetStatusOp(makeIdentity(t, "René \nDescartes", "rene@descartes.fr"), unix, common.ClosedStatus),
+ NewSetStatusOp(makeIdentity(t, "René Descartes", "rene@\ndescartes.fr"), unix, common.ClosedStatus),
&CreateOperation{OpBase: dag.NewOpBase(CreateOp, rene, 0),
Title: "title",
Message: "message",
diff --git a/entities/bug/snapshot.go b/entities/bug/snapshot.go
index cece09b8..442496f7 100644
--- a/entities/bug/snapshot.go
+++ b/entities/bug/snapshot.go
@@ -4,6 +4,7 @@ import (
"fmt"
"time"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entities/identity"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/entity/dag"
@@ -15,7 +16,7 @@ var _ dag.Snapshot = &Snapshot{}
type Snapshot struct {
id entity.Id
- Status Status
+ Status common.Status
Title string
Comments []Comment
Labels []Label
diff --git a/entities/bug/status.go b/entities/common/status.go
index b8fba609..6859891a 100644
--- a/entities/bug/status.go
+++ b/entities/common/status.go
@@ -1,4 +1,4 @@
-package bug
+package common
import (
"fmt"
diff --git a/go.mod b/go.mod
index 0b49cc35..7219a886 100644
--- a/go.mod
+++ b/go.mod
@@ -92,9 +92,12 @@ require (
github.com/willf/bitset v1.1.10 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
+ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
+ golang.org/x/tools v0.1.10 // indirect
+ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
diff --git a/go.sum b/go.sum
index 7ff32c6b..a69db0cf 100644
--- a/go.sum
+++ b/go.sum
@@ -437,6 +437,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
+golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -591,6 +592,7 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
+golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/query/parser.go b/query/parser.go
index 68eda6bb..03b36c0d 100644
--- a/query/parser.go
+++ b/query/parser.go
@@ -3,7 +3,7 @@ package query
import (
"fmt"
- "github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
)
// Parse parse a query DSL
@@ -32,7 +32,7 @@ func Parse(query string) (*Query, error) {
case tokenKindKV:
switch t.qualifier {
case "status", "state":
- status, err := bug.StatusFromString(t.value)
+ status, err := common.StatusFromString(t.value)
if err != nil {
return nil, err
}
diff --git a/query/parser_test.go b/query/parser_test.go
index d07f8514..f2aeb0e9 100644
--- a/query/parser_test.go
+++ b/query/parser_test.go
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/require"
- "github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
)
func TestParse(t *testing.T) {
@@ -18,10 +18,10 @@ func TestParse(t *testing.T) {
{":value", nil},
{"status:open", &Query{
- Filters: Filters{Status: []bug.Status{bug.OpenStatus}},
+ Filters: Filters{Status: []common.Status{common.OpenStatus}},
}},
{"status:closed", &Query{
- Filters: Filters{Status: []bug.Status{bug.ClosedStatus}},
+ Filters: Filters{Status: []common.Status{common.ClosedStatus}},
}},
{"status:unknown", nil},
@@ -84,7 +84,7 @@ func TestParse(t *testing.T) {
&Query{
Search: []string{"search", "more terms"},
Filters: Filters{
- Status: []bug.Status{bug.OpenStatus},
+ Status: []common.Status{common.OpenStatus},
Author: []string{"René Descartes"},
Participant: []string{"leonhard"},
Label: []string{"hello", "Good first issue"},
diff --git a/query/query.go b/query/query.go
index db507499..6b53ecd9 100644
--- a/query/query.go
+++ b/query/query.go
@@ -1,6 +1,8 @@
package query
-import "github.com/MichaelMure/git-bug/entities/bug"
+import (
+ "github.com/MichaelMure/git-bug/entities/common"
+)
// Query is the intermediary representation of a Bug's query. It is either
// produced by parsing a query string (ex: "status:open author:rene") or created
@@ -31,7 +33,7 @@ type StringPair struct {
// Filters is a collection of Filter that implement a complex filter
type Filters struct {
- Status []bug.Status
+ Status []common.Status
Author []string
Metadata []StringPair
Actor []string
diff --git a/termui/show_bug.go b/termui/show_bug.go
index c77000f5..6cace04a 100644
--- a/termui/show_bug.go
+++ b/termui/show_bug.go
@@ -11,6 +11,7 @@ import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entities/bug"
+ "github.com/MichaelMure/git-bug/entities/common"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/util/colors"
)
@@ -624,10 +625,10 @@ func (sb *showBug) setTitle(g *gocui.Gui, v *gocui.View) error {
func (sb *showBug) toggleOpenClose(g *gocui.Gui, v *gocui.View) error {
switch sb.bug.Snapshot().Status {
- case bug.OpenStatus:
+ case common.OpenStatus:
_, err := sb.bug.Close()
return err
- case bug.ClosedStatus:
+ case common.ClosedStatus:
_, err := sb.bug.Open()
return err
default: