From 742158366614b782f84986b48aed949da0eb3f23 Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Tue, 26 Jan 2016 12:31:33 +0900 Subject: [PATCH] go/vcs: drop support for Google Code Project Hosting The hosting service was shut down on January 25, 2016 and a few tests started to fail like the following: === RUN TestRepoRootForImportPath --- FAIL: TestRepoRootForImportPath (2.47s) vcs_test.go:129: RepoRootForImport("code.google.com/p/go"): unable to detect version control system for code.google.com/ path FAIL This change drops support for code.google.com and fixes test. See http://google-opensource.blogspot.jp/2015/03/farewell-to-google-code.html for further information. Fixes golang/go#14105 Change-Id: I87cb9a3d666c2a1af0f8bf39a66ba0f669c99fd5 Reviewed-on: https://go-review.googlesource.com/18951 Reviewed-by: Brad Fitzpatrick --- go/vcs/vcs.go | 53 ---------------------------------------------- go/vcs/vcs_test.go | 14 ------------ 2 files changed, 67 deletions(-) diff --git a/go/vcs/vcs.go b/go/vcs/vcs.go index 8b45cd882c3..f0aed571f27 100644 --- a/go/vcs/vcs.go +++ b/go/vcs/vcs.go @@ -598,20 +598,6 @@ var vcsPaths = []*vcsPath{ check: noVCSSuffix, }, - // Google Code - new syntax - { - prefix: "code.google.com/", - re: `^(?Pcode\.google\.com/[pr]/(?P[a-z0-9\-]+)(\.(?P[a-z0-9\-]+))?)(/[A-Za-z0-9_.\-]+)*$`, - repo: "https://{root}", - check: googleCodeVCS, - }, - - // Google Code - old syntax - { - re: `^(?P[a-z0-9_\-.]+)\.googlecode\.com/(git|hg|svn)(?P/.*)?$`, - check: oldGoogleCode, - }, - // Github { prefix: "github.com/", @@ -667,45 +653,6 @@ func noVCSSuffix(match map[string]string) error { return nil } -var googleCheckout = regexp.MustCompile(`id="checkoutcmd">(hg|git|svn)`) - -// googleCodeVCS determines the version control system for -// a code.google.com repository, by scraping the project's -// /source/checkout page. -func googleCodeVCS(match map[string]string) error { - if err := noVCSSuffix(match); err != nil { - return err - } - data, err := httpGET(expand(match, "https://code.google.com/p/{project}/source/checkout?repo={subrepo}")) - if err != nil { - return err - } - - if m := googleCheckout.FindSubmatch(data); m != nil { - if vcs := ByCmd(string(m[1])); vcs != nil { - // Subversion requires the old URLs. - // TODO: Test. - if vcs == vcsSvn { - if match["subrepo"] != "" { - return fmt.Errorf("sub-repositories not supported in Google Code Subversion projects") - } - match["repo"] = expand(match, "https://{project}.googlecode.com/svn") - } - match["vcs"] = vcs.Cmd - return nil - } - } - - return fmt.Errorf("unable to detect version control system for code.google.com/ path") -} - -// oldGoogleCode is invoked for old-style foo.googlecode.com paths. -// It prints an error giving the equivalent new path. -func oldGoogleCode(match map[string]string) error { - return fmt.Errorf("invalid Google Code import path: use %s instead", - expand(match, "code.google.com/p/{project}{path}")) -} - // bitbucketVCS determines the version control system for a // Bitbucket repository, by using the Bitbucket API. func bitbucketVCS(match map[string]string) error { diff --git a/go/vcs/vcs_test.go b/go/vcs/vcs_test.go index 1ff519a17c1..2d4bcda39b3 100644 --- a/go/vcs/vcs_test.go +++ b/go/vcs/vcs_test.go @@ -26,20 +26,6 @@ func TestRepoRootForImportPath(t *testing.T) { path string want *RepoRoot }{ - { - "code.google.com/p/go", - &RepoRoot{ - VCS: vcsHg, - Repo: "https://code.google.com/p/go", - }, - }, - { - "code.google.com/r/go", - &RepoRoot{ - VCS: vcsHg, - Repo: "https://code.google.com/r/go", - }, - }, { "github.com/golang/groupcache", &RepoRoot{