Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
e5335101
Commit
e5335101
authored
Jul 30, 2012
by
David Symonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/dashboard/codereview: switch to using gobot to update CL reviewer info.
R=rsc CC=golang-dev
https://golang.org/cl/6453063
parent
41688046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
25 deletions
+11
-25
misc/dashboard/codereview/dashboard/cl.go
misc/dashboard/codereview/dashboard/cl.go
+11
-25
No files found.
misc/dashboard/codereview/dashboard/cl.go
View file @
e5335101
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"io"
"io"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
netmail
"net/mail"
"net/url"
"net/url"
"regexp"
"regexp"
"sort"
"sort"
...
@@ -23,7 +22,6 @@ import (
...
@@ -23,7 +22,6 @@ import (
"appengine"
"appengine"
"appengine/datastore"
"appengine/datastore"
"appengine/mail"
"appengine/taskqueue"
"appengine/taskqueue"
"appengine/urlfetch"
"appengine/urlfetch"
"appengine/user"
"appengine/user"
...
@@ -35,6 +33,7 @@ func init() {
...
@@ -35,6 +33,7 @@ func init() {
}
}
const
codereviewBase
=
"http://codereview.appspot.com"
const
codereviewBase
=
"http://codereview.appspot.com"
const
gobotBase
=
"http://research.swtch.com/gobot_codereview"
var
clRegexp
=
regexp
.
MustCompile
(
`\d+`
)
var
clRegexp
=
regexp
.
MustCompile
(
`\d+`
)
...
@@ -184,34 +183,21 @@ func handleAssign(w http.ResponseWriter, r *http.Request) {
...
@@ -184,34 +183,21 @@ func handleAssign(w http.ResponseWriter, r *http.Request) {
if
!
found
{
if
!
found
{
c
.
Infof
(
"Adding %v as a reviewer of CL %v"
,
rev
,
n
)
c
.
Infof
(
"Adding %v as a reviewer of CL %v"
,
rev
,
n
)
// We can't do this easily, as we need authentication to edit
url
:=
fmt
.
Sprintf
(
"%s?cl=%s&r=%s"
,
gobotBase
,
n
,
rev
)
// an issue on behalf of a user, which is non-trivial. For now,
resp
,
err
:=
urlfetch
.
Client
(
c
)
.
Get
(
url
)
// just send a mail with the body "R=<reviewer>", Cc'ing that person,
// and rely on social convention.
cl
:=
new
(
CL
)
err
:=
datastore
.
Get
(
c
,
key
,
cl
)
if
err
!=
nil
{
if
err
!=
nil
{
c
.
Errorf
(
"
%s
"
,
err
)
c
.
Errorf
(
"
Gobot GET failed: %v
"
,
err
)
http
.
Error
(
w
,
err
.
Error
(),
500
)
http
.
Error
(
w
,
err
.
Error
(),
500
)
return
return
}
}
msg
:=
&
mail
.
Message
{
defer
resp
.
Body
.
Close
()
Sender
:
u
.
Email
,
if
resp
.
StatusCode
!=
200
{
To
:
[]
string
{
preferredEmail
[
rev
]},
c
.
Errorf
(
"Gobot GET failed: got HTTP response %d"
,
resp
.
StatusCode
)
Cc
:
cl
.
Recipients
,
http
.
Error
(
w
,
"Failed contacting Gobot"
,
500
)
// Take care to match Rietveld's subject line
return
// so that Gmail will correctly thread mail.
Subject
:
cl
.
Subject
+
" (issue "
+
n
+
")"
,
Body
:
"R="
+
rev
+
"
\n\n
(sent by gocodereview)"
,
}
if
cl
.
LastMessageID
!=
""
{
msg
.
Headers
=
netmail
.
Header
{
"In-Reply-To"
:
[]
string
{
cl
.
LastMessageID
},
}
}
if
err
:=
mail
.
Send
(
c
,
msg
);
err
!=
nil
{
c
.
Errorf
(
"mail.Send: %v"
,
err
)
}
}
c
.
Infof
(
"Gobot said %q"
,
resp
.
Status
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment