示例#1
0
func (s *Store) OpenManifests() (m *Manifests, err error) {
	const name = "00manifest"

	c, err := revlog.Open(&encodedName{s.root, name, name})
	if err == nil {
		m = &Manifests{c}
	}
	return
}
示例#2
0
func runRevlog(cmd *Command, w io.Writer, args []string) {
	if len(args) == 0 {
		fatalf("missing argument: revlog index file")
	}
	index, err := revlog.Open(storeName(args[0]))
	if err != nil {
		fatalf("%s", err)
	}

	if *revlogR == -1 {
		index.Dump(w)
		return
	}

	r, err := revlog.FileRevSpec(*revlogR).Lookup(index)
	if err != nil {
		fatalf("%s", err)
	}
	if !*revlogBuild {
		dh := &dataHelper{}
		d, err := r.GetData(dh)
		if dh.file != nil {
			dh.file.Close()
		}
		if err != nil {
			fatalf("%s", err)
		}
		if r.IsBase() {
			w.Write(d)
		} else {
			hunks, err := patch.Parse(d)
			if err != nil {
				fatalf("%s", err)
			}
			for _, h := range hunks {
				h.Dump(w)
			}
		}
	} else {
		fb := revlog.NewFileBuilder()
		err = fb.BuildWrite(w, r)
		if err != nil {
			fatalf("%s", err)
		}
	}
}
示例#3
0
func (s *Store) OpenRevlog(fileName string) (*revlog.Index, error) {
	i, d := s.fe.Encode("data/" + fileName)
	return revlog.Open(&encodedName{s.root, i, d})
}
示例#4
0
func (s *Store) OpenChangeLog() (*revlog.Index, error) {
	const name = "00changelog"
	return revlog.Open(&encodedName{s.root, name, name})
}