gerc

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: ISC Imports: 18 Imported by: 1

README

gerc - good enough revision control

-- features

gerc can read some of a mercurial repository.

Documentation

Overview

gerc - good enough revision control

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindRepo

func FindRepo(start string) (string, error)

Find the root directory for a repository, starting at start.

func Unidiff

func Unidiff(name1, date1 string, d1 []byte, name2, date2 string, d2 []byte) string

Create a unified format diff.

func WriteUnidiff

func WriteUnidiff(w io.Writer, name1, date1 string, d1 []byte, name2, date2 string, d2 []byte) bool

Write a unified format diff.

Types

type AnnotateArgs

type AnnotateArgs struct {
	Filename  string
	Revisions string
}

type Annotation

type Annotation struct {
	Line       string
	Annotation string
}

func Annotate

func Annotate(s1 []Annotation, s2 string, a2 string) []Annotation

Take a slice of annotated lines and diff against a new string. Add new annotations for any new lines. Initialize a slice of annotations by starting with nil.

type Change

type Change struct {
	Linkrev int
	NodeID  [32]byte
	P1rev   int
	P1node  [32]byte
	P2rev   int
	P2node  [32]byte
	ID      []byte
	User    string
	Date    time.Time
	Tz      int64
	Files   []string
	Summary string
	Message []string
	Tags    []string
	Diff    string
	// contains filtered or unexported fields
}

One changelog entry

func (*Change) ComputeID added in v0.1.4

func (change *Change) ComputeID()

func (*Change) Print

func (change *Change) Print(w io.Writer, verbose bool)

Format and print one change

func (*Change) Sha1 added in v0.1.4

func (change *Change) Sha1() []byte

type ChangesArgs

type ChangesArgs struct {
	Revisions string
	Filename  string
	WithDiff  bool
}

type DiffLine

type DiffLine struct {
	Line string
	Type byte // ' ', '+', or '-'
}

func Diff

func Diff(l1 []string, l2 []string) []DiffLine

Create a diff using the patience algorithm.

type FileDataArgs

type FileDataArgs struct {
	Filename string
	Revision string
}

type FileNotFoundError

type FileNotFoundError struct{}

A file could not be found

func (FileNotFoundError) Error

func (e FileNotFoundError) Error() string

type FilesArgs

type FilesArgs struct {
	Filenames []string
	Revision  string
}

type ManifestFile

type ManifestFile struct {
	Name     string
	Revision string
	Flags    byte
}

One file in the manifest

type Repo

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

A handle to a repository

func Open

func Open(path string) (*Repo, error)

Open a repository located at path. This is the directory that contains .hg.

func (*Repo) Annotate

func (repo *Repo) Annotate(args AnnotateArgs) ([]Annotation, error)

Annotate a file

func (*Repo) Close

func (repo *Repo) Close()

Close a repository, free resources.

func (*Repo) FSPath

func (repo *Repo) FSPath(filename string) (string, error)

Return an absolute path to a file in the filesystem

func (*Repo) GetChanges

func (repo *Repo) GetChanges(args ChangesArgs) ([]*Change, error)

Get changes from the changelog.

func (*Repo) GetFileData

func (repo *Repo) GetFileData(args FileDataArgs) ([]byte, error)

Get the data for a file.

func (*Repo) GetFiles

func (repo *Repo) GetFiles(args FilesArgs) ([]ManifestFile, error)

Get the files in the manifest.

func (*Repo) GetTags

func (repo *Repo) GetTags() []Tag

Get all the tags

func (*Repo) Root added in v0.1.4

func (repo *Repo) Root() string

type Rev

type Rev struct {
	Offset  uint64
	Flags   uint16
	Clen    uint32
	Ulen    uint32
	Baserev int // uint32
	Linkrev int // uint32
	P1rev   int // uint32
	P2rev   int // uint32
	NodeID  [32]byte
	// contains filtered or unexported fields
}

One revision. This is mostly an internal data structure.

func (*Rev) ChunkData

func (rev *Rev) ChunkData(repo *Repo, datafile string) ([]byte, error)

Get the data for this chunk. It may be a delta.

func (*Rev) Sha1 added in v0.1.4

func (rev *Rev) Sha1() []byte

type RevisionNotFoundError

type RevisionNotFoundError struct{}

A revision could not be found

func (RevisionNotFoundError) Error

func (e RevisionNotFoundError) Error() string

type Revlog

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

A revlog structure

func (revlog *Revlog) FindLink(linkrev int) int

Return the index in this revlog for a link.

func (*Revlog) Get

func (revlog *Revlog) Get(i int) (*Rev, error)

Get one revision from the revlog, by index.

func (*Revlog) GetData

func (revlog *Revlog) GetData(idx int) ([]byte, []byte, error)

Get the data for an index. This will apply deltas as necessary to reconstruct the data. Returns data, metadata, error.

func (*Revlog) Len

func (revlog *Revlog) Len() int

Returns the length.

type Tag

type Tag struct {
	Name    string
	Linkrev int
	NodeID  [32]byte
}

A tag

Directories

Path Synopsis
gerc command line utility
gerc command line utility

Jump to

Keyboard shortcuts

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