1
0
mirror of https://github.com/golang/go synced 2024-11-11 18:21:40 -07:00

misc/makerelease: use new storage api, handle git sub-repos

Change-Id: I8c5b77d861aafdc594714982503da7bee053c9fe
Reviewed-on: https://go-review.googlesource.com/1291
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Andrew Gerrand 2014-12-10 13:05:37 +11:00
parent 38ecd2e267
commit 508a22d5bc

View File

@ -14,6 +14,7 @@ import (
"compress/gzip"
"crypto/sha1"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
@ -30,7 +31,7 @@ import (
"strings"
"code.google.com/p/goauth2/oauth"
storage "code.google.com/p/google-api-go-client/storage/v1beta2"
storage "code.google.com/p/google-api-go-client/storage/v1"
)
var (
@ -512,8 +513,15 @@ func (b *Build) get(repoPath, revision string) error {
}
// Update the repo to the specified revision.
p := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
_, err = b.run(p, "hg", "update", revision)
dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
switch {
case exists(filepath.Join(dest, ".git")):
_, err = b.run(dest, "git", "checkout", revision)
case exists(filepath.Join(dest, ".hg")):
_, err = b.run(dest, "hg", "update", revision)
default:
err = errors.New("unknown version control system")
}
return err
}