From a6c97ce1443f68f8e7940e22ad9b90c33a4cb6a0 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 12 Dec 2014 16:30:15 -0500 Subject: [PATCH] dashboard/builder: remove the repo export speed hack for hg The builder will no longer generate a VERSION file, so we can revert https://golang.org/cl/1405 once all builders have updated. Fixes golang/go#9296. Change-Id: Ie51cb06a712157c16b231167f166b31d10ba8667 Signed-off-by: Shenghou Ma Reviewed-on: https://go-review.googlesource.com/1510 Reviewed-by: Andrew Gerrand Reviewed-by: Chris Manghane --- dashboard/builder/env.go | 8 -------- dashboard/builder/vcs.go | 27 +++------------------------ 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index fe92172125..34a40bd593 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -7,7 +7,6 @@ package main import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -125,13 +124,6 @@ func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (strin if err := repo.Export(goworkpath, hash); err != nil { return "", fmt.Errorf("error exporting repository: %s", err) } - // Write out VERSION file if it does not already exist. - vFile := filepath.Join(goworkpath, "VERSION") - if _, err := os.Stat(vFile); os.IsNotExist(err) { - if err := ioutil.WriteFile(vFile, []byte(hash), 0644); err != nil { - return "", fmt.Errorf("error writing VERSION file: %s", err) - } - } return filepath.Join(goworkpath, "src"), nil } diff --git a/dashboard/builder/vcs.go b/dashboard/builder/vcs.go index 97300c6442..2139a9000a 100644 --- a/dashboard/builder/vcs.go +++ b/dashboard/builder/vcs.go @@ -63,30 +63,9 @@ func (r *Repo) Clone(path, rev string) (*Repo, error) { // Export exports the current Repo at revision rev to a new destination. func (r *Repo) Export(path, rev string) error { - r.Lock() - - downloadPath := r.Path - if !r.Exists() { - r.Unlock() - _, err := r.Clone(path, rev) - return err - } - - switch r.Master.VCS.Cmd { - default: - r.Unlock() - // TODO(adg,cmang): implement Export in go/vcs - _, err := r.Clone(path, rev) - return err - case "hg": - defer r.Unlock() - cmd := exec.Command(r.Master.VCS.Cmd, "archive", "-t", "files", "-r", rev, path) - cmd.Dir = downloadPath - if err := run(cmd); err != nil { - return fmt.Errorf("executing %v: %v", cmd.Args, err) - } - } - return nil + // TODO(adg,cmang): implement Export in go/vcs + _, err := r.Clone(path, rev) + return err } // UpdateTo updates the working copy of this Repo to the