Skip to content

Commit

Permalink
maintner: removed the cl url generator
Browse files Browse the repository at this point in the history
Restored the maintner file moving the cl url generator to the gopherbot logic as in the previous version.
  • Loading branch information
Ivan Palladino committed Aug 22, 2019
1 parent 590a834 commit ebf4772
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
2 changes: 1 addition & 1 deletion cmd/gopherbot/gopherbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ func (b *gopherbot) cl2issue(ctx context.Context) error {
// already processed this issue.
return nil
}
prefix := fmt.Sprintf("Change %s", cl.URL().String())
prefix := fmt.Sprintf("Change https://golang.org/cl/%d", cl.Number)
for _, ref := range cl.GitHubIssueRefs {
if id := ref.Repo.ID(); id.Owner != "golang" || id.Repo != "go" {
continue
Expand Down
10 changes: 0 additions & 10 deletions maintner/gerrit.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,16 +509,6 @@ func (cl *GerritCL) CommitAtVersion(version int32) *GitCommit {
return cl.Project.commit[hash]
}

// URL returns the absolute url of the CL.
func (cl *GerritCL) URL() *url.URL {
s := fmt.Sprintf("https://golang.org/cl/%d", cl.Number)
u, err := url.Parse(s)
if err != nil {
return &url.URL{}
}
return u
}

func (cl *GerritCL) updateGithubIssueRefs() {
gp := cl.Project
gerrit := gp.gerrit
Expand Down
17 changes: 0 additions & 17 deletions maintner/gerrit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,20 +559,3 @@ func TestGerritHashtagsLen(t *testing.T) {
}
}
}

func TestGerritURL(t *testing.T) {
tests := []struct {
set int32
want string
}{
{0, "https://golang.org/cl/0"},
{1238812784, "https://golang.org/cl/1238812784"},
}
for _, tt := range tests {
cl := &GerritCL{Number: tt.set}
got := cl.URL().String()
if got != tt.want {
t.Errorf("For set %d, url = %#v; want %v", tt.set, got, tt.want)
}
}
}

0 comments on commit ebf4772

Please sign in to comment.