]> Cypherpunks repositories - gostls13.git/commitdiff
misc/makerelease: handle git sub-repositories
authorAndrew Gerrand <adg@golang.org>
Wed, 10 Dec 2014 02:04:06 +0000 (13:04 +1100)
committerDavid Symonds <dsymonds@golang.org>
Thu, 11 Dec 2014 06:36:39 +0000 (17:36 +1100)
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

misc/makerelease/makerelease.go

index 43b1f3d115d28152d5db159d91736c9c442e5700..1cb8df05177c28720e52bca796c7b03989e3e279 100644 (file)
@@ -505,15 +505,31 @@ func (b *Build) extras() error {
 }
 
 func (b *Build) get(repoPath, revision string) error {
-       // Fetch the packages (without building/installing).
-       _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"),
-               "get", "-d", repoPath+"/...")
-       if err != nil {
-               return err
+       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).
+               _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"),
+                       "get", "-d", repoPath+"/...")
+               if err != nil {
+                       return err
+               }
        }
 
        // Update the repo to the specified revision.
        dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath))
+       var err error
        switch {
        case exists(filepath.Join(dest, ".git")):
                _, err = b.run(dest, "git", "checkout", revision)