func bzrParseStat(rev, out string) (*RevInfo, error) {
var revno int64
var tm time.Time
+ var tags []string
for _, line := range strings.Split(out, "\n") {
if line == "" || line[0] == ' ' || line[0] == '\t' {
// End of header, start of commit message.
return nil, vcsErrorf("unexpected timestamp from bzr log: %q", line)
}
tm = t.UTC()
+ case "tags":
+ tags = strings.Split(val, ", ")
}
}
if revno == 0 || tm.IsZero() {
Short: fmt.Sprintf("%012d", revno),
Time: tm,
Version: rev,
+ Tags: tags,
}
return info, nil
}
go install
go version -m $GOBIN/a$GOEXE
! stdout bzrrevision
+stdout '^\tmod\texample.com/a\t\(devel\)'
rm $GOBIN/a$GOEXE
# If there is a repository, but it can't be used for some reason,
stdout '^\tbuild\tvcs.revision='
stdout '^\tbuild\tvcs.time='
stdout '^\tbuild\tvcs.modified=false$'
+stdout '^\tmod\texample.com/a\tv0.0.0-\d+-\d+\t+'
+rm $GOBIN/a$GOEXE
+
+# Tag is reflected in the version.
+cd ..
+cp README README2
+exec bzr add a README2
+exec bzr commit -m 'second commit'
+exec bzr tag v1.2.3
+cd a
+go install
+go version -m $GOBIN/a$GOEXE
+stdout '^\tbuild\tvcs=bzr$'
+stdout '^\tbuild\tvcs.revision='
+stdout '^\tbuild\tvcs.time='
+stdout '^\tbuild\tvcs.modified=false$'
+stdout '^\tmod\texample.com/a\tv1.2.3\t+'
rm $GOBIN/a$GOEXE
# Building an earlier commit should still build clean.