Пример #1
0
func parseRevision(s string) gosrc.Revision {
	var rev gosrc.Revision
	parts := strings.Split(s, "\n")
	if len(parts) == 3 {
		rev.Id = parts[0]
		d, _ := time.Parse(iso8601Date, parts[1])
		rev.Date = d
		rev.Author = parts[2]
	}
	return rev
}
Пример #2
0
func parseBzrRevision(s string) gosrc.Revision {
	var rev gosrc.Revision
	for _, l := range strings.Split(s, "\n") {
		parts := strings.SplitN(l, " ", 2)
		if len(parts) == 2 {
			switch parts[0] {
			case "revno:":
				rev.Id = parts[1]
			case "committer:":
				rev.Author = parts[1]
			case "timestamp:":
				d, _ := time.Parse(bzrDate, parts[1])
				rev.Date = d
			}
		}
	}
	return rev
}