]> Cypherpunks repositories - gostls13.git/commitdiff
misc/makerelease: use new storage api, handle git sub-repos
authorAndrew Gerrand <adg@golang.org>
Wed, 10 Dec 2014 02:05:37 +0000 (13:05 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 10 Dec 2014 02:08:38 +0000 (02:08 +0000)
Change-Id: I8c5b77d861aafdc594714982503da7bee053c9fe
Reviewed-on: https://go-review.googlesource.com/1291
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/makerelease/makerelease.go

index 8cf6be2a434d35eb2b3d0b6624ce554006e90627..43b1f3d115d28152d5db159d91736c9c442e5700 100644 (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
 }