Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(479)

Side by Side Diff: misc/dashboard/builder/hg.go

Issue 4172056: code review 4172056: gobuilder: add -package flag to build external packages (Closed)
Patch Set: diff -r 0309fd640319 https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « misc/dashboard/builder/exec.go ('k') | misc/dashboard/builder/http.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
1 package main 5 package main
2 6
3 import ( 7 import (
4 "fmt" 8 "fmt"
5 "os" 9 "os"
10 "regexp"
6 "strconv" 11 "strconv"
7 "strings" 12 "strings"
8 ) 13 )
9 14
10 type Commit struct { 15 type Commit struct {
11 num int // mercurial revision number 16 num int // mercurial revision number
12 node string // mercurial hash 17 node string // mercurial hash
13 parent string // hash of commit's parent 18 parent string // hash of commit's parent
14 user string // author's Name <email> 19 user string // author's Name <email>
15 date string // date of commit 20 date string // date of commit
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 "--encoding", "utf-8", 55 "--encoding", "utf-8",
51 "--rev", rev, 56 "--rev", rev,
52 "--limit", "1", 57 "--limit", "1",
53 "--template", format, 58 "--template", format,
54 ) 59 )
55 if err != nil { 60 if err != nil {
56 return 61 return
57 } 62 }
58 return strings.Split(s, ">", 5), nil 63 return strings.Split(s, ">", 5), nil
59 } 64 }
65
66 var revisionRe = regexp.MustCompile(`([0-9]+):[0-9a-f]+$`)
67
68 // getTag fetches a Commit by finding the first hg tag that matches re.
69 func getTag(re *regexp.Regexp) (c Commit, tag string, err os.Error) {
70 o, _, err := runLog(nil, "", goroot, "hg", "tags")
71 for _, l := range strings.Split(o, "\n", -1) {
72 tag = re.FindString(l)
73 if tag == "" {
74 continue
75 }
76 s := revisionRe.FindStringSubmatch(l)
77 if s == nil {
78 err = os.NewError("couldn't find revision number")
79 return
80 }
81 c, err = getCommit(s[1])
82 return
83 }
84 err = os.NewError("no matching tag found")
85 return
86 }
OLDNEW
« no previous file with comments | « misc/dashboard/builder/exec.go ('k') | misc/dashboard/builder/http.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b