1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:57:58 -07:00

misc/dashboard/app: add debug logging to notifyOnFailure; remove unused Result.OK function

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6258064
This commit is contained in:
Andrew Gerrand 2012-05-31 14:09:50 +10:00
parent 023a7e881c
commit 735ec94591
2 changed files with 9 additions and 14 deletions

View File

@ -168,15 +168,6 @@ func partsToHash(c *Commit, p []string) *Result {
} }
} }
// OK returns the Commit's build state for a specific builder and goHash.
func (c *Commit) OK(builder, goHash string) (ok, present bool) {
r := c.Result(builder, goHash)
if r == nil {
return false, false
}
return r.OK, true
}
// A Result describes a build result for a Commit on an OS/architecture. // A Result describes a build result for a Commit on an OS/architecture.
// //
// Each Result entity is a descendant of its associated Commit entity. // Each Result entity is a descendant of its associated Commit entity.

View File

@ -37,12 +37,12 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error {
p := &Package{Path: com.PackagePath} p := &Package{Path: com.PackagePath}
var broken *Commit var broken *Commit
ok, present := com.OK(builder, "") cr := com.Result(builder, "")
if !present { if cr == nil {
return fmt.Errorf("no result for %s/%s", com.Hash, builder) return fmt.Errorf("no result for %s/%s", com.Hash, builder)
} }
q := datastore.NewQuery("Commit").Ancestor(p.Key(c)) q := datastore.NewQuery("Commit").Ancestor(p.Key(c))
if ok { if cr.OK {
// This commit is OK. Notify if next Commit is broken. // This commit is OK. Notify if next Commit is broken.
next := new(Commit) next := new(Commit)
q.Filter("ParentHash=", com.Hash) q.Filter("ParentHash=", com.Hash)
@ -53,7 +53,9 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error {
} }
return err return err
} }
if ok, present := next.OK(builder, ""); present && !ok { if nr := next.Result(builder, ""); nr != nil && !nr.OK {
c.Debugf("commit ok: %#v\nresult: %#v", com, cr)
c.Debugf("next commit broken: %#v\nnext result:%#v", next, nr)
broken = next broken = next
} }
} else { } else {
@ -68,7 +70,9 @@ func notifyOnFailure(c appengine.Context, com *Commit, builder string) error {
} }
return err return err
} }
if ok, present := prev.OK(builder, ""); present && ok { if pr := prev.Result(builder, ""); pr != nil && pr.OK {
c.Debugf("commit broken: %#v\nresult: %#v", com, cr)
c.Debugf("previous commit ok: %#v\nprevious result:%#v", prev, pr)
broken = com broken = com
} }
} }