hit-0.5.4: Git operations in haskell

Portabilityunix
Stabilityexperimental
MaintainerNicolas DI PRIMA <nicolas@di-prima.fr>
Safe HaskellNone

Data.Git.Diff

Contents

Description

Basic Git diff methods.

Synopsis

Basic features

data BlobContent Source

represents a blob's content (i.e., the content of a file at a given reference).

Constructors

FileContent [ByteString]

Text file's lines

BinaryContent ByteString

Binary content

Instances

data BlobState Source

This is a blob description at a given state (revision)

Constructors

BlobState 

Instances

Eq BlobState

Two BlobState are equal if they have the same filename, i.e.,

 ((BlobState x _ _ _) == (BlobState y _ _ _)) = (x == y)
Show BlobState 

data BlobStateDiff Source

Represents a file state between two revisions A file (a blob) can be present in the first Tree's revision but not in the second one, then it has been deleted. If only in the second Tree's revision, then it has been created. If it is in the both, maybe it has been changed.

getDiffWithSource

Arguments

:: (BlobStateDiff -> a -> a)

diff helper (State -> accumulator -> accumulator)

-> a

accumulator

-> Ref

commit reference (the original state)

-> Ref

commit reference (the new state)

-> Git

repository

-> IO a 

generate a diff list between two revisions with a given diff helper.

Useful to extract any kind of information from two different revisions. For example you can get the number of deleted files:

 getdiffwith f 0 head^ head git
     where f (OnlyOld _) acc = acc+1
           f _           acc = acc

Or save the list of new files:

 getdiffwith f [] head^ head git
     where f (OnlyNew bs) acc = (bsFilename bs):acc
           f _            acc = acc

Default helpers

data HitDiffContent Source

This is an example of how you can use Hit to get all of information between different revision.

Instances

data HitDiff Source

This represents a diff.

Constructors

HitDiff 

Instances

defaultDiff :: BlobStateDiff -> [HitDiff] -> [HitDiff]Source

A default diff helper. It is an example about how you can write your own diff helper or you can use it if you want to get all of differences.

getDiffSource

Arguments

:: Ref

commit ref

-> Ref

commit ref

-> Git

repository

-> IO [HitDiff] 

A default Diff getter which returns all diff information (Mode, Content and Binary).

 getDiff = getDiffWith defaultDiff