git-0.2.0: Git operations in haskell

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunix
Safe HaskellNone
LanguageHaskell98

Data.Git.Repository

Contents

Description

 

Synopsis

Documentation

data Git hash Source #

represent a git repo, with possibly already opened filereaders for indexes and packs

Config

configGetAll :: Git hash -> IO [Config] Source #

Read the Config

configGet Source #

Arguments

:: Git hash

Git context

-> String

section name

-> String

key name

-> IO (Maybe String)

The resulting value if it exists

Get a configuration element from the config file, starting from the local repository config file, then the global config file.

for example the equivalent to git config user.name is:

configGet git "user" "name"

newtype Config Source #

Constructors

Config [Section] 

Instances

data Section Source #

Constructors

Section 

Trees

type HTree hash = [(ModePerm, EntName, HTreeEnt hash)] Source #

data HTreeEnt hash Source #

hierarchy tree, either a reference to a blob (file) or a tree (directory).

Constructors

TreeDir (Ref hash) (HTree hash) 
TreeFile (Ref hash) 

getCommitMaybe :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Commit hash)) Source #

get a specified commit

getCommit :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Commit hash) Source #

get a specified commit but raises an exception if doesn't exists or type is not appropriate

getTreeMaybe :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Tree hash)) Source #

get a specified tree

getTree :: (Typeable hash, HashAlgorithm hash) => Git hash -> Ref hash -> IO (Tree hash) Source #

get a specified tree but raise

rewrite Source #

Arguments

:: (Typeable hash, HashAlgorithm hash) 
=> Git hash

Repository

-> (Commit hash -> IO (Commit hash))

Mapping function

-> Revision

revision to start from

-> Int

the number of parents to map

-> IO (Ref hash)

return the new head REF

Rewrite a set of commits from a revision and returns the new ref.

If during revision traversal (diving) there's a commit with zero or multiple parents then the traversal will stop regardless of the amount of parent requested.

calling "rewrite f 2 (revisionOf d)" on the following tree:

a <-- b <-- c <-- d

result in the following tree after mapping with f:

a <-- f(b) <-- f(c) <-- f(d)

buildHTree :: (Typeable hash, HashAlgorithm hash) => Git hash -> Tree hash -> IO (HTree hash) Source #

build a hierarchy tree from a tree object

resolvePath Source #

Arguments

:: (Typeable hash, HashAlgorithm hash) 
=> Git hash

repository

-> Ref hash

commit reference

-> EntPath

paths

-> IO (Maybe (Ref hash)) 

resolve the ref (tree or blob) related to a path at a specific commit ref

resolveTreeish :: HashAlgorithm hash => Git hash -> Ref hash -> IO (Maybe (Tree hash)) Source #

returns a tree from a ref that might be either a commit, a tree or a tag.

resolveRevision :: (Typeable hash, HashAlgorithm hash) => Git hash -> Revision -> IO (Maybe (Ref hash)) Source #

try to resolve a string to a specific commit ref for example: HEAD, HEAD^, master~3, shortRef

initRepo :: LocalPath -> IO () Source #

initialize a new repository at a specific location.

isRepo :: LocalPath -> IO Bool Source #

basic checks to see if a specific path looks like a git repo.

named refs manipulation

branchWrite Source #

Arguments

:: Git hash

repository

-> RefName

the name of the branch to write

-> Ref hash

the reference to set

-> IO () 

Write a branch to point to a specific reference

branchList :: Git hash -> IO (Set RefName) Source #

Return the list of branches

tagWrite Source #

Arguments

:: Git hash

repository

-> RefName

the name of the tag to write

-> Ref hash

the reference to set

-> IO () 

Write a tag to point to a specific reference

tagList :: Git hash -> IO (Set RefName) Source #

Return the list of branches

headSet Source #

Arguments

:: Git hash

repository

-> Either (Ref hash) RefName

either a raw reference or a branch name

-> IO () 

Set head to point to either a reference or a branch name.

headGet :: HashAlgorithm hash => Git hash -> IO (Either (Ref hash) RefName) Source #

Get what the head is pointing to, or the reference otherwise