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 <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1510
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
This commit is contained in:
Shenghou Ma 2014-12-12 16:30:15 -05:00 committed by Minux Ma
parent f56df04f2d
commit a6c97ce144
2 changed files with 3 additions and 32 deletions

View File

@ -7,7 +7,6 @@ package main
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "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 { if err := repo.Export(goworkpath, hash); err != nil {
return "", fmt.Errorf("error exporting repository: %s", err) 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 return filepath.Join(goworkpath, "src"), nil
} }

View File

@ -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. // Export exports the current Repo at revision rev to a new destination.
func (r *Repo) Export(path, rev string) error { func (r *Repo) Export(path, rev string) error {
r.Lock() // TODO(adg,cmang): implement Export in go/vcs
_, err := r.Clone(path, rev)
downloadPath := r.Path return err
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
} }
// UpdateTo updates the working copy of this Repo to the // UpdateTo updates the working copy of this Repo to the