mirror of
https://github.com/golang/go.git
synced 2025-05-06 08:03:03 +00:00
misc/makerelease: handle git sub-repositories
Also: checkout sub-repos from Mercurial manually instead of using "go get". (for the 1.4 release) LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/190720043
This commit is contained in:
parent
026b5bbc8b
commit
a56a3876e8
@ -505,15 +505,31 @@ func (b *Build) extras() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Build) get(repoPath, revision string) error {
|
func (b *Build) get(repoPath, revision string) error {
|
||||||
|
dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
|
||||||
|
|
||||||
|
if strings.HasPrefix(repoPath, "golang.org/x/") {
|
||||||
|
// For sub-repos, fetch the old Mercurial repo; bypass "go get".
|
||||||
|
// DO NOT import this special case into the git tree.
|
||||||
|
|
||||||
|
if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
repo := strings.Replace(repoPath, "golang.org/x/", "https://code.google.com/p/go.", 1)
|
||||||
|
if _, err := b.run(b.gopath, "hg", "clone", repo, dest); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// Fetch the packages (without building/installing).
|
// Fetch the packages (without building/installing).
|
||||||
_, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"),
|
_, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"),
|
||||||
"get", "-d", repoPath+"/...")
|
"get", "-d", repoPath+"/...")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the repo to the specified revision.
|
// Update the repo to the specified revision.
|
||||||
dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
|
dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
|
||||||
|
var err error
|
||||||
switch {
|
switch {
|
||||||
case exists(filepath.Join(dest, ".git")):
|
case exists(filepath.Join(dest, ".git")):
|
||||||
_, err = b.run(dest, "git", "checkout", revision)
|
_, err = b.run(dest, "git", "checkout", revision)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user