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

Unified Diff: milo/git/history.go

Issue 2983513002: gitiles.Log: implement paging. (Closed)
Patch Set: with client Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: milo/git/history.go
diff --git a/milo/git/history.go b/milo/git/history.go
index efcfb200e532d8dd83fdedb30322c1cc191b6ede..aaaa6f8ab8764cc25e9e45100557c0259a76271a 100644
--- a/milo/git/history.go
+++ b/milo/git/history.go
@@ -20,6 +20,7 @@ import (
"encoding/hex"
"fmt"
"io/ioutil"
+ "net/http"
"regexp"
"golang.org/x/net/context"
@@ -32,6 +33,7 @@ import (
"github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/proto/google"
+ "github.com/luci/luci-go/server/auth"
milo "github.com/luci/luci-go/milo/api/proto"
)
@@ -151,7 +153,17 @@ func GetHistory(c context.Context, url, commitish string, limit int) (*milo.Cons
ret := &milo.ConsoleGitInfo{}
cacheKey := fmt.Sprintf("GetHistory|%s|%s|%d", url, commitish, limit)
err = protoCache(c, useCache, cacheKey, ret, func() error {
- rawEntries, err := gitiles.Log(c, url, commitish, limit)
+ t, err := auth.GetRPCTransport(c, auth.AsSelf, auth.WithScopes(
+ "https://www.googleapis.com/auth/gerritcodereview",
+ ))
+ if err != nil {
+ return errors.Annotate(err, "getting RPC Transport").Err()
+ }
+ cl, err := gitiles.New(&http.Client{Transport: t}, url)
+ if err != nil {
+ return errors.Annotate(err, "repo URL not valid").Err()
+ }
+ rawEntries, err := cl.Log(c, commitish, limit)
if err != nil {
return errors.Annotate(err, "GetHistory").Err()
}

Powered by Google App Engine
This is Rietveld 408576698