revlog

package
v0.0.0-...-a6d3b49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2015 License: BSD-3-Clause, BSD-3-Clause Imports: 13 Imported by: 0

README

Revlog NG == version 1 (since Mercurial 0.9)

revision index: file extension .i

Two storage types:

-	each revision record is followed by patch data
	(next revision record starts after that data)

	This is for rather small files.

-	patch data corresponding to revisions are stored externally,
	in a file with same base name (stem), but extension `.d'

Index record format is described at http://mercurial.selenic.com/wiki/RevlogNG

A data chunk starts either with

	u	uncompressed, skip 1 byte (the `u')

	0	uncompressed, dont skip

or
	x	zlib compressed

A data chunk consists of a collection of hunks, each starting
with three 4-byte values: start, end, length, followed by
the data.


/home/micha/ib/wmipf.de/home/ib/mercurial/mercurial/revlog.py

Documentation

Overview

Package revlog provides read access to RevlogNG files.

Index

Constants

This section is empty.

Variables

View Source
var ErrRevNotFound = errors.New("revision not found")
View Source
var ErrRevisionAmbiguous = errors.New("hg/revlog: ambiguous revision spec")
View Source
var ErrRevisionNotFound = errors.New("hg/revlog: revision not found")

Functions

This section is empty.

Types

type DataCache

type DataCache interface {
	Get(int) []byte
	Store(int, []byte)
}

type DataHelper

type DataHelper interface {
	Open(string) (DataReadCloser, error)
	TmpBuffer() *bytes.Buffer
}

type DataReadCloser

type DataReadCloser interface {
	io.ReaderAt
	io.Closer
}

type FileBuilder

type FileBuilder struct {
	// contains filtered or unexported fields
}

func NewFileBuilder

func NewFileBuilder() (p *FileBuilder)

func (*FileBuilder) Build

func (p *FileBuilder) Build(r *Rec) (file []byte, err error)

func (*FileBuilder) BuildWrite

func (p *FileBuilder) BuildWrite(w io.Writer, r *Rec) (err error)

func (*FileBuilder) Bytes

func (p *FileBuilder) Bytes() []byte

func (*FileBuilder) CloseData

func (p *FileBuilder) CloseData() (err error)

func (*FileBuilder) KeepDataOpen

func (p *FileBuilder) KeepDataOpen()

func (*FileBuilder) PreparePatch

func (p *FileBuilder) PreparePatch(r *Rec) (f *FilePatch, err error)

func (*FileBuilder) SetDataCache

func (p *FileBuilder) SetDataCache(dc DataCache)

type FilePatch

type FilePatch struct {
	MetaData []byte
	MetaSkip int
	// contains filtered or unexported fields
}

func (*FilePatch) Apply

func (p *FilePatch) Apply(w io.Writer) (err error)

type FileRevSpec

type FileRevSpec int

func (FileRevSpec) Lookup

func (n FileRevSpec) Lookup(i *Index) (r *Rec, err error)

type Index

type Index struct {
	// contains filtered or unexported fields
}

func Open

func Open(name Name) (rlog *Index, err error)

func (*Index) Dump

func (rv *Index) Dump(w io.Writer)

func (Index) NewHash

func (id Index) NewHash() hash.Hash

func (Index) NewNodeId

func (id Index) NewNodeId(b []byte) NodeId

func (*Index) Null

func (i *Index) Null() *Rec

func (*Index) Record

func (rv *Index) Record(i int) *Rec

func (*Index) Tip

func (i *Index) Tip() *Rec

type LinkRevSpec

type LinkRevSpec struct {
	Rev int

	// FindPresent should examine maybeAncestors' Linkrev values to
	// find a changelog record that is an ancestor of Rev. It also has to
	// make sure that the file actually existed in the revision specified
	// by Rev.
	// If FindPresent is nil (the default), Lookup will -- in case of multiple
	// matching branches -- return the last visited record, or a Null record
	// if no revision matches at all.
	FindPresent func(maybeAncestors []*Rec) (index int, err error)
}

A LinkRevSpec can be used to find a file revision that was present at a certain changelog revision, by examining the filelog records' linkrev values. The behaviour of the Lookup method can be configured by setting FindPresent to a user implemented function.

func NewLinkRevSpec

func NewLinkRevSpec(rev int) *LinkRevSpec

func (LinkRevSpec) Lookup

func (l LinkRevSpec) Lookup(i *Index) (match *Rec, err error)

type Name

type Name interface {
	Index() string
	Data() string
}

type NodeId

type NodeId []byte

func NewId

func NewId(hash string) (id NodeId, err error)

func (NodeId) Eq

func (i NodeId) Eq(i2 NodeId) bool

func (NodeId) Node

func (i NodeId) Node() string

func (NodeId) String

func (i NodeId) String() string

type NodeIdImpl

type NodeIdImpl interface {
	NewHash() hash.Hash
	NewNodeId([]byte) NodeId
}

type NodeIdRevSpec

type NodeIdRevSpec string

func (NodeIdRevSpec) Lookup

func (hash NodeIdRevSpec) Lookup(rv *Index) (r *Rec, err error)

type NullRevSpec

type NullRevSpec struct{}

func (NullRevSpec) Lookup

func (NullRevSpec) Lookup(i *Index) (r *Rec, err error)

func (NullRevSpec) String

func (NullRevSpec) String() string

type Rec

type Rec struct {
	Index *Index
	// contains filtered or unexported fields
}

func (*Rec) BaseRev

func (r *Rec) BaseRev() int

func (*Rec) FileRev

func (r *Rec) FileRev() int

func (*Rec) GetData

func (r *Rec) GetData(dh DataHelper) (data []byte, err error)

func (*Rec) Id

func (r *Rec) Id() NodeId

func (*Rec) IsBase

func (r *Rec) IsBase() bool

func (*Rec) IsDescendant

func (r *Rec) IsDescendant(rev2 int) (is bool)

IsDescendant follows all branches that originate in r until it passes record rev2. If that record is found to be on one of these branches, it is a descendant of r.

func (*Rec) IsLeaf

func (r *Rec) IsLeaf() (yes bool)

func (*Rec) IsStartOfBranch

func (r *Rec) IsStartOfBranch() bool

func (*Rec) Next

func (r *Rec) Next() *Rec

func (*Rec) Parent

func (r *Rec) Parent() *Rec

func (*Rec) Parent1NotPrevious

func (r *Rec) Parent1NotPrevious() bool

func (*Rec) Parent2

func (r *Rec) Parent2() *Rec

func (*Rec) Parent2Present

func (r *Rec) Parent2Present() bool

func (*Rec) Prev

func (r *Rec) Prev() *Rec

type RevisionSpec

type RevisionSpec interface {
	Lookup(*Index) (*Rec, error)
}

type TipRevSpec

type TipRevSpec struct{}

func (TipRevSpec) Lookup

func (TipRevSpec) Lookup(i *Index) (r *Rec, err error)

func (TipRevSpec) String

func (TipRevSpec) String() string

Directories

Path Synopsis
The patch package provides support for calculating and applying revlog patches
The patch package provides support for calculating and applying revlog patches

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL