x/tools/dashboard/app: record branch names, disallow multiple first commits

Change-Id: I3fed749bb0b5c2084a490eb4c6696c4555a0ac9c
Reviewed-on: https://go-review.googlesource.com/1174
Reviewed-by: David Symonds <dsymonds@golang.org>
This commit is contained in:
Andrew Gerrand 2014-12-08 18:26:27 +11:00
parent 78a571aa37
commit 97f1340e43
2 changed files with 6 additions and 0 deletions

View File

@ -94,6 +94,7 @@ type Commit struct {
Time time.Time
NeedsBenchmarking bool
TryPatch bool
Branch string
// ResultData is the Data string of each build Result for this Commit.
// For non-Go commits, only the Results for the current Go tip, weekly,

View File

@ -183,6 +183,11 @@ func addCommit(c appengine.Context, com *Commit) error {
if n == 0 {
return errors.New("parent commit not found")
}
} else if com.Num != 1 {
// This is the first commit; fail if it is not number 1.
// (This will happen if we try to upload a new/different repo
// where there is already commit data. A bad thing to do.)
return errors.New("this package already has a first commit; aborting")
}
// update the tip Tag if this is the Go repo and this isn't on a release branch
if p.Path == "" && !strings.HasPrefix(com.Desc, "[") && !isUpdate {