mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 02:01:43 +03:00
Rebased and updated.
This commit is contained in:
parent
0c42a7c33e
commit
f1d5ca4ff4
25
cache/bug_excerpt.go
vendored
25
cache/bug_excerpt.go
vendored
@ -23,11 +23,16 @@ type BugExcerpt struct {
|
||||
CreateUnixTime int64
|
||||
EditUnixTime int64
|
||||
|
||||
Title string
|
||||
Status bug.Status
|
||||
Author identity.Interface
|
||||
LenComments int
|
||||
Labels []bug.Label
|
||||
Title string
|
||||
LenComments int
|
||||
|
||||
// If author is identity.Bare, LegacyAuthor is set
|
||||
// If author is identity.Identity, AuthorId is set and data is deported
|
||||
// in a IdentityExcerpt
|
||||
LegacyAuthor LegacyAuthorExcerpt
|
||||
AuthorId string
|
||||
|
||||
CreateMetadata map[string]string
|
||||
}
|
||||
@ -45,13 +50,25 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
|
||||
EditLamportTime: b.EditLamportTime(),
|
||||
CreateUnixTime: b.FirstOp().GetUnixTime(),
|
||||
EditUnixTime: snap.LastEditUnix(),
|
||||
Title: snap.Title,
|
||||
Status: snap.Status,
|
||||
Labels: snap.Labels,
|
||||
Title: snap.Title,
|
||||
LenComments: len(snap.Comments),
|
||||
CreateMetadata: b.FirstOp().AllMetadata(),
|
||||
}
|
||||
|
||||
switch snap.Author.(type) {
|
||||
case *identity.Identity:
|
||||
e.AuthorId = snap.Author.Id()
|
||||
case *identity.Bare:
|
||||
e.LegacyAuthor = LegacyAuthorExcerpt{
|
||||
Login: snap.Author.Login(),
|
||||
Name: snap.Author.Name(),
|
||||
}
|
||||
default:
|
||||
panic("unhandled identity type")
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
|
4
cache/filter.go
vendored
4
cache/filter.go
vendored
@ -57,7 +57,7 @@ func LabelFilter(label string) Filter {
|
||||
|
||||
// TitleFilter return a Filter that match a title
|
||||
func TitleFilter(title string) Filter {
|
||||
return func(excerpt *BugExcerpt) bool {
|
||||
return func(repo *RepoCache, excerpt *BugExcerpt) bool {
|
||||
return strings.Contains(excerpt.Title, title)
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ func (f *Filters) Match(repoCache *RepoCache, excerpt *BugExcerpt) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if match := f.andMatch(f.Title, excerpt); !match {
|
||||
if match := f.andMatch(f.Title, repoCache, excerpt); !match {
|
||||
return false
|
||||
}
|
||||
|
||||
|
9
cache/repo_cache.go
vendored
9
cache/repo_cache.go
vendored
@ -386,15 +386,6 @@ func (c *RepoCache) ResolveBug(id string) (*BugCache, error) {
|
||||
|
||||
return cached, nil
|
||||
}
|
||||
// ResolveBugExcerpt retrieve a BugExcerpt matching the exact given id
|
||||
func (c *RepoCache) ResolveBugExcerpt(id string) (*BugExcerpt, error) {
|
||||
e, ok := c.excerpts[id]
|
||||
if !ok {
|
||||
return nil, bug.ErrBugNotExist
|
||||
}
|
||||
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// ResolveBugExcerpt retrieve a BugExcerpt matching the exact given id
|
||||
func (c *RepoCache) ResolveBugExcerpt(id string) (*BugExcerpt, error) {
|
||||
|
@ -52,14 +52,10 @@ func runLsBug(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// truncate + pad if needed
|
||||
titleFmt := fmt.Sprintf("%-50.50s", b.Title)
|
||||
authorFmt := fmt.Sprintf("%-15.15s", b.Author.Name)
|
||||
authorFmt := fmt.Sprintf("%-15.15s", b.LegacyAuthor.Name)
|
||||
|
||||
fmt.Printf("%s %s\t%s\t%s\tC:%d L:%d\n",
|
||||
<<<<<<< HEAD
|
||||
colors.Cyan(b.HumanId()),
|
||||
=======
|
||||
colors.Cyan(b.Id),
|
||||
>>>>>>> Made requested changes
|
||||
colors.Yellow(b.Status),
|
||||
titleFmt,
|
||||
colors.Magenta(authorFmt),
|
||||
|
Loading…
Reference in New Issue
Block a user