Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: milo/appengine/console/console.go

Issue 2952473003: [milo] mv backend/git/gitiles -> common/gitiles (Closed)
Patch Set: typo :) Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « milo/appengine/common/gitiles/gitiles.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package console 5 package console
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "strings" 10 "strings"
11 11
12 "golang.org/x/net/context" 12 "golang.org/x/net/context"
13 13
14 "github.com/luci/luci-go/common/clock" 14 "github.com/luci/luci-go/common/clock"
15 "github.com/luci/luci-go/common/logging" 15 "github.com/luci/luci-go/common/logging"
16 "github.com/luci/luci-go/server/router" 16 "github.com/luci/luci-go/server/router"
17 17
18 "github.com/luci/luci-go/milo/api/config" 18 "github.com/luci/luci-go/milo/api/config"
19 "github.com/luci/luci-go/milo/api/resp" 19 "github.com/luci/luci-go/milo/api/resp"
20 "github.com/luci/luci-go/milo/appengine/backend/git"
21 "github.com/luci/luci-go/milo/appengine/buildbot" 20 "github.com/luci/luci-go/milo/appengine/buildbot"
22 "github.com/luci/luci-go/milo/appengine/common" 21 "github.com/luci/luci-go/milo/appengine/common"
22 "github.com/luci/luci-go/milo/appengine/common/gitiles"
23 ) 23 )
24 24
25 // Returns results of build[commit_index][builder_index] 25 // Returns results of build[commit_index][builder_index]
26 func GetConsoleBuilds( 26 func GetConsoleBuilds(
27 c context.Context, module string, 27 c context.Context, module string,
28 builders []resp.BuilderRef, commits []string) ( 28 builders []resp.BuilderRef, commits []string) (
29 [][]*resp.ConsoleBuild, error) { 29 [][]*resp.ConsoleBuild, error) {
30 30
31 switch module { 31 switch module {
32 case "buildbot": 32 case "buildbot":
(...skipping 25 matching lines...) Expand all
58 http.Redirect(w, r, fmt.Sprintf("/console/%s/main", proj), http.StatusMo vedPermanently) 58 http.Redirect(w, r, fmt.Sprintf("/console/%s/main", proj), http.StatusMo vedPermanently)
59 return 59 return
60 } 60 }
61 61
62 func console(c context.Context, project, name string) (*resp.Console, error) { 62 func console(c context.Context, project, name string) (*resp.Console, error) {
63 tStart := clock.Now(c) 63 tStart := clock.Now(c)
64 def, err := getConsoleDef(c, project, name) 64 def, err := getConsoleDef(c, project, name)
65 if err != nil { 65 if err != nil {
66 return nil, err 66 return nil, err
67 } 67 }
68 » commits, err := git.GetCommits(c, def.RepoURL, def.Branch, 25) 68 » commits, err := gitiles.GetCommits(c, def.RepoURL, def.Branch, 25)
69 if err != nil { 69 if err != nil {
70 return nil, err 70 return nil, err
71 } 71 }
72 tGitiles := clock.Now(c) 72 tGitiles := clock.Now(c)
73 logging.Debugf(c, "Loading commits took %s.", tGitiles.Sub(tStart)) 73 logging.Debugf(c, "Loading commits took %s.", tGitiles.Sub(tStart))
74 commitNames := make([]string, len(commits)) 74 commitNames := make([]string, len(commits))
75 commitLinks := make([]*resp.Link, len(commits)) 75 commitLinks := make([]*resp.Link, len(commits))
76 for i, commit := range commits { 76 for i, commit := range commits {
77 commitNames[i] = commit.Revision.Label 77 commitNames[i] = commit.Revision.Label
78 commitLinks[i] = commit.Revision 78 commitLinks[i] = commit.Revision
(...skipping 20 matching lines...) Expand all
99 } 99 }
100 100
101 cs := &resp.Console{ 101 cs := &resp.Console{
102 Name: def.Name, 102 Name: def.Name,
103 Commit: ccb, 103 Commit: ccb,
104 BuilderRef: builders, 104 BuilderRef: builders,
105 } 105 }
106 106
107 return cs, nil 107 return cs, nil
108 } 108 }
OLDNEW
« no previous file with comments | « milo/appengine/common/gitiles/gitiles.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698