func parseEntryData(data []byte) (result *Entry, err error) { var c Entry // separate comments from other data s := string(data) if i := strings.Index(s, "\n\n"); i != -1 { c.Comment = strings.TrimSpace(s[i+2:]) c.Summary = strings.TrimSpace(strings.Split(c.Comment, "\n")[0]) s = s[:i] } // split data into lines f := strings.Split(s, "\n") if len(f) < 3 { err = ErrCorrupted return } c.ManifestNode, err = revlog.NewId(f[0]) if err != nil { return } c.Committer = f[1] // f[2] contains date/timezone information, as well // as probably branch and source information tf := strings.SplitN(f[2], " ", 3) if len(tf) < 2 { err = ErrCorrupted return } c.Files = f[3:] // parse date/timezone us, err := strconv.ParseInt(tf[0], 10, 64) if err != nil { return } offset, err := strconv.Atoi(tf[1]) if err != nil { return } c.Date = time.Unix(us, 0).In(time.FixedZone("", -offset)) if len(tf) == 3 { c.Branch = parseMetaSection(tf[2], "\000")["branch"] } result = &c return }
func (e *ManifestEnt) Id() (revlog.NodeId, error) { hash, _ := e.value() return revlog.NewId(hash) }