Skip to content

Instantly share code, notes, and snippets.

@minux
Created December 12, 2014 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minux/c2b1c270ac1c7ea1a0cc to your computer and use it in GitHub Desktop.
Save minux/c2b1c270ac1c7ea1a0cc to your computer and use it in GitHub Desktop.
dashboard/builder: remove the repo export speed hack for hg
From 73e8a39c6f92390ffac7a2debc4f328c308a2147 Mon Sep 17 00:00:00 2001
From: Shenghou Ma <minux@golang.org>
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 <minux@golang.org>
---
dashboard/builder/env.go | 8 --------
dashboard/builder/vcs.go | 20 ++++----------------
2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go
index fe92172..34a40bd 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 97300c6..2af4b3b 100644
--- a/dashboard/builder/vcs.go
+++ b/dashboard/builder/vcs.go
@@ -65,28 +65,16 @@ func (r *Repo) Clone(path, rev string) (*Repo, error) {
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
+ r.Unlock()
+ // 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
--
1.7.12.4 (Apple Git-37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment