hgo

package module
v0.0.0-...-d45f189 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: BSD-3-Clause Imports: 12 Imported by: 13

README

Hgo is a collection of Go packages providing read-access to local Mercurial repositories. Only a subset of Mercurial's functionality is supported. It is possible to access revisions of files and to read changelogs, manifests, and tags.

Hgo supports the following repository features:

* revlogv1
* store
* fncache (no support for hash encoded names, though)
* dotencode

The Go packages have been implemented from scratch, based on information found in Mercurial's wiki.

The project should be considered unstable. The BUGS file lists known issues yet to be addressed.

cmd/hgo contains an example program that implements a few commands similar to a subset of Mercurial's hg.

Documentation

Overview

Package hgo provides read access to Mercurial repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectRoot

func FindProjectRoot(orig string) (root string, err error)

Find the root of a project, given the name of a file or directory anywhere within the project's directory tree.

Types

type BranchHeads

type BranchHeads struct {
	IdByName map[string]string
	ById     map[string][]string
}

BranchHeads contains a mapping from branch names to head changeset IDs, and a mapping from head changeset IDs to slices of branch names.

func (*BranchHeads) Add

func (bh *BranchHeads) Add(name, id string)

Associate a new branch with a changeset ID.

func (*BranchHeads) Sort

func (bh *BranchHeads) Sort()

For each changeset ID within the ById member, sort the branch names associated with it in increasing order. This function should be called if one or more branches have been inserted using Add.

type Repository

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

func OpenRepository

func OpenRepository(root string) (r *Repository, err error)

Open a repository located at the given project root directory, i.e. a directory that contains a subdirectory named ‘.hg’.

func (*Repository) BranchHeads

func (r *Repository) BranchHeads() (*BranchHeads, error)

BranchHeads parses and returns the repository's branch heads.

func (*Repository) NewStore

func (r *Repository) NewStore() *store.Store

NewStore returns a new Store instance that provides access to the repository's changelog, manifests, and filelogs.

func (*Repository) RelFileName

func (r *Repository) RelFileName(name string) (rel string, err error)

For a given absolute or relative file name, compute a name relative to the repository's root.

func (*Repository) Tags

func (r *Repository) Tags() (tGlobal, tAll *Tags)

Parse tags, and return one Tags structure containing only global tags, another one containing both global and local tags.

type Tags

type Tags struct {
	IdByName map[string]string
	ById     map[string][]string
}

Tags contains a mapping from tag names to changeset IDs, and a mapping from changesetIDs to slices of tag names.

func (*Tags) Add

func (t *Tags) Add(name, id string)

Associate a new tag with a changeset ID.

func (*Tags) Sort

func (t *Tags) Sort()

For each changeset ID within the ById member, sort the tag names associated with it in increasing order. This function should be called if one or more tags have been inserted using Add.

Directories

Path Synopsis
Package changelog provides read access to the changelog.
Package changelog provides read access to the changelog.
cmd
hgo
An example program that aims to imitate a subset of Mercurial's sub-commands.
An example program that aims to imitate a subset of Mercurial's sub-commands.
Package revlog provides read access to RevlogNG files.
Package revlog provides read access to RevlogNG files.
patch
The patch package provides support for calculating and applying revlog patches
The patch package provides support for calculating and applying revlog patches
Package store provides access to Mercurial's ‘store’ repository format.
Package store provides access to Mercurial's ‘store’ repository format.

Jump to

Keyboard shortcuts

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