From a652b8bab4f1544b9d8b954711202d231826fc64 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Thu, 4 Dec 2014 10:43:23 +1100 Subject: [PATCH] x/tools/go/vcs: support go.googlecode.com paths Also fix a bug in CreateAtRev, which was doing something hg-specific. LGTM=cmang R=cmang CC=golang-codereviews https://golang.org/cl/180540043 --- go/vcs/vcs.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/go/vcs/vcs.go b/go/vcs/vcs.go index 586e1b8a..700b84da 100644 --- a/go/vcs/vcs.go +++ b/go/vcs/vcs.go @@ -239,9 +239,10 @@ func (v *Cmd) Create(dir, repo string) error { // The parent of dir must exist; dir must not. // rev must be a valid revision in repo. func (v *Cmd) CreateAtRev(dir, repo, rev string) error { - // Append revision flag to CreateCmd - createAtRevCmd := v.CreateCmd + " --rev=" + rev - return v.run(".", createAtRevCmd, "dir", dir, "repo", repo) + if err := v.Create(dir, repo); err != nil { + return err + } + return v.run(dir, v.TagSyncCmd, "tag", rev) } // Download downloads any new changes for the repo in dir. @@ -589,6 +590,15 @@ func expand(match map[string]string, s string) string { // vcsPaths lists the known vcs paths. var vcsPaths = []*vcsPath{ + // go.googlesource.com + { + prefix: "go.googlesource.com", + re: `^(?Pgo\.googlesource\.com/[A-Za-z0-9_.\-]+/?)$`, + vcs: "git", + repo: "https://{root}", + check: noVCSSuffix, + }, + // Google Code - new syntax { prefix: "code.google.com/",