diff --git a/dashboard/app/app.yaml b/dashboard/app/app.yaml index 48ba805231..fa03da868c 100644 --- a/dashboard/app/app.yaml +++ b/dashboard/app/app.yaml @@ -11,11 +11,11 @@ api_version: go1 handlers: - url: /static static_dir: static -- url: /(|gccgo/|git/)log/.+ +- url: /(|gccgo/|hg/)log/.+ script: _go_app -- url: /(|gccgo/|git/)(|commit|packages|result|perf-result|tag|todo|perf|perfdetail|perfgraph|updatebenchmark) +- url: /(|gccgo/|hg/)(|commit|packages|result|perf-result|tag|todo|perf|perfdetail|perfgraph|updatebenchmark) script: _go_app -- url: /(|gccgo/|git/)(init|buildtest|key|perflearn|_ah/queue/go/delay) +- url: /(|gccgo/|hg/)(init|buildtest|key|perflearn|_ah/queue/go/delay) script: _go_app login: admin diff --git a/dashboard/app/build/dash.go b/dashboard/app/build/dash.go index 82ef14d82b..b456f170a5 100644 --- a/dashboard/app/build/dash.go +++ b/dashboard/app/build/dash.go @@ -21,9 +21,10 @@ func handleFunc(path string, h http.HandlerFunc) { // Dashboard describes a unique build dashboard. type Dashboard struct { - Name string // This dashboard's name and namespace - Prefix string // The path prefix (no trailing /) - Packages []*Package // The project's packages to build + Name string // This dashboard's name (eg, "Go") + Namespace string // This dashboard's namespace (eg, "" (default), "Git") + Prefix string // The path prefix (no trailing /) + Packages []*Package // The project's packages to build } // dashboardForRequest returns the appropriate dashboard for a given URL path. @@ -31,8 +32,8 @@ func dashboardForRequest(r *http.Request) *Dashboard { if strings.HasPrefix(r.URL.Path, gccgoDash.Prefix) { return gccgoDash } - if strings.HasPrefix(r.URL.Path, gitDash.Prefix) { - return gitDash + if strings.HasPrefix(r.URL.Path, hgDash.Prefix) { + return goDash } return goDash } @@ -40,11 +41,10 @@ func dashboardForRequest(r *http.Request) *Dashboard { // Context returns a namespaced context for this dashboard, or panics if it // fails to create a new context. func (d *Dashboard) Context(c appengine.Context) appengine.Context { - // No namespace needed for the original Go dashboard. - if d.Name == "Go" { + if d.Namespace == "" { return c } - n, err := appengine.Namespace(c, d.Name) + n, err := appengine.Namespace(c, d.Namespace) if err != nil { panic(err) } @@ -52,17 +52,19 @@ func (d *Dashboard) Context(c appengine.Context) appengine.Context { } // the currently known dashboards. -var dashboards = []*Dashboard{goDash, gitDash, gccgoDash} +var dashboards = []*Dashboard{goDash, hgDash, gccgoDash} -// goDash is the dashboard for the main go repository. -var goDash = &Dashboard{ - Name: "Go", - Prefix: "", - Packages: goPackages, +// hgDash is the dashboard for the old Mercural Go repository. +var hgDash = &Dashboard{ + Name: "Mercurial", + Namespace: "", // Used to be the default. + Prefix: "/hg", + Packages: hgPackages, } -// goPackages is a list of all of the packages built by the main go repository. -var goPackages = []*Package{ +// hgPackages is a list of all of the packages +// built by the old Mercurial Go repository. +var hgPackages = []*Package{ { Kind: "go", Name: "Go", @@ -114,16 +116,16 @@ var goPackages = []*Package{ }, } -// gitDash is the dashboard for the main go repository on git. -var gitDash = &Dashboard{ - Name: "Git", - Prefix: "/git", - Packages: gitPackages, +// goDash is the dashboard for the main go repository. +var goDash = &Dashboard{ + Name: "Go", + Namespace: "Git", + Prefix: "", + Packages: goPackages, } -// gitPackages is a list of all of the packages built by the main go repository -// on git. -var gitPackages = []*Package{ +// goPackages is a list of all of the packages built by the main go repository. +var goPackages = []*Package{ { Kind: "go", Name: "Go", @@ -182,8 +184,9 @@ var gitPackages = []*Package{ // gccgoDash is the dashboard for gccgo. var gccgoDash = &Dashboard{ - Name: "Gccgo", - Prefix: "/gccgo", + Name: "Gccgo", + Namespace: "Gccgo", + Prefix: "/gccgo", Packages: []*Package{ { Kind: "gccgo", diff --git a/dashboard/app/build/handler.go b/dashboard/app/build/handler.go index 931ffc12f1..b11d584b06 100644 --- a/dashboard/app/build/handler.go +++ b/dashboard/app/build/handler.go @@ -27,7 +27,7 @@ import ( ) const commitsPerPage = 30 -const watcherVersion = 2 +const watcherVersion = 3 // must match dashboard/watcher/watcher.go's watcherVersion // commitHandler retrieves commit data or records a new commit. // diff --git a/dashboard/app/build/ui.go b/dashboard/app/build/ui.go index 9e75292eea..9891e3f816 100644 --- a/dashboard/app/build/ui.go +++ b/dashboard/app/build/ui.go @@ -435,24 +435,24 @@ func repoURL(dashboard, hash, packagePath string) (string, error) { if dashboard == "Gccgo" { return "https://code.google.com/p/gofrontend/source/detail?r=" + hash, nil } - if dashboard == "Git" { - return "https://go.googlesource.com/go/+/" + hash, nil - } return "https://golang.org/change/" + hash, nil } - if dashboard == "Git" { - repo := strings.TrimPrefix(packagePath, "golang.org/x/") - return "https://go.googlesource.com/" + repo + "/+/" + hash, nil + + // TODO(adg): remove this old hg stuff, one day. + if dashboard == "Mercurial" { + m := repoRe.FindStringSubmatch(packagePath) + if m == nil { + return "", errors.New("unrecognized package: " + packagePath) + } + url := "https://code.google.com/p/" + m[1] + "/source/detail?r=" + hash + if len(m) > 2 { + url += "&repo=" + m[2][1:] + } + return url, nil } - m := repoRe.FindStringSubmatch(packagePath) - if m == nil { - return "", errors.New("unrecognized package: " + packagePath) - } - url := "https://code.google.com/p/" + m[1] + "/source/detail?r=" + hash - if len(m) > 2 { - url += "&repo=" + m[2][1:] - } - return url, nil + + repo := strings.TrimPrefix(packagePath, "golang.org/x/") + return "https://go.googlesource.com/" + repo + "/+/" + hash, nil } // tail returns the trailing n lines of s. diff --git a/dashboard/watcher/watcher.go b/dashboard/watcher/watcher.go index d80713c98d..6b6999d30d 100644 --- a/dashboard/watcher/watcher.go +++ b/dashboard/watcher/watcher.go @@ -26,11 +26,16 @@ import ( "time" ) -const goBase = "https://go.googlesource.com/" +const ( + goBase = "https://go.googlesource.com/" + watcherVersion = 3 // must match dashboard/app/build/handler.go's watcherVersion + origin = "origin/" + master = origin + "master" // name of the master branch +) var ( repoURL = flag.String("repo", goBase+"go", "Repository URL") - dashboard = flag.String("dash", "https://build.golang.org/git/", "Dashboard URL (must end in /)") + dashboard = flag.String("dash", "https://build.golang.org/", "Dashboard URL (must end in /)") keyFile = flag.String("key", defaultKeyFile, "Build dashboard key file") pollInterval = flag.Duration("poll", 10*time.Second, "Remote repo poll interval") network = flag.Bool("network", true, "Enable network calls (disable for testing)") @@ -283,7 +288,7 @@ func (r *Repo) postCommit(c *Commit) error { return nil } - u := *dashboard + "commit?version=2&key=" + dashboardKey + u := fmt.Sprintf("%vcommit?version=%v&key=%v", *dashboard, watcherVersion, dashboardKey) resp, err := http.Post(u, "text/json", bytes.NewReader(b)) if err != nil { return err @@ -306,11 +311,6 @@ func (r *Repo) postCommit(c *Commit) error { return nil } -const ( - origin = "origin/" - master = origin + "master" // name of the master branch -) - // update looks for new commits and branches, // and updates the commits and branches maps. func (r *Repo) update(noisy bool) error {