gi-ggit-1.0.8: libgit2-glib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Ggit.Structs.Patch

Contents

Description

Represents a patch object.

Synopsis

Exported types

newtype Patch Source #

Memory-managed wrapper type.

Constructors

Patch (ManagedPtr Patch) 
Instances
Eq Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

Methods

(==) :: Patch -> Patch -> Bool

(/=) :: Patch -> Patch -> Bool

BoxedObject Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

Methods

boxedType :: Patch -> IO GType

IsGValue Patch Source #

Convert Patch to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Ggit.Structs.Patch

Methods

toGValue :: Patch -> IO GValue

fromGValue :: GValue -> IO Patch

noPatch :: Maybe Patch Source #

A convenience alias for Nothing :: Maybe Patch.

Methods

Overloaded methods

getDelta

patchGetDelta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m (Maybe DiffDelta)

Returns: the tDiffDelta of the patch or Nothing.

Get the diff delta corresponding to the patch.

getHunk

patchGetHunk Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch

-> Word32

idx: the hunk index.

-> m (Maybe DiffHunk)

Returns: a new tDiffHunk or Nothing on error. (Can throw GError)

Get the idx'th hunk in the patch.

getLineStats

patchGetLineStats Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m (Word32, Word32, Word32)

(Can throw GError)

Get the line statistics of the patch.

getNumHunks

patchGetNumHunks Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m Word32

Returns: the number of hunks.

Get the number of hunks in the patch.

getNumLinesInHunk

patchGetNumLinesInHunk Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> Word32

hunk: the hunk index.

-> m Int32

Returns: the number of lines.

Get the number of lines in hunk.

newFromBlobs

patchNewFromBlobs Source #

Arguments

:: (HasCallStack, MonadIO m, IsBlob a, IsBlob b, IsDiffOptions c) 
=> Maybe a

oldBlob: a tBlob to diff from.

-> Maybe Text

oldAsPath: treat oldBlob as if it had this filename, or Nothing,

-> Maybe b

newBlob: a tBlob to diff to.

-> Maybe Text

newAsPath: treat newBlob as if it had this filename, or Nothing,

-> Maybe c

diffOptions: a tDiffOptions, or Nothing.

-> m (Maybe Patch)

Returns: a newly created tPatch or Nothing. (Can throw GError)

Directly generate a patch from the difference between two blobs.

This is just like diffBlobs except it generates a patch object for the difference instead of directly making callbacks. You can use the standard ggit_patch accessor functions to read the patch data, and you must call ggit_patch_unref on the patch when done.

newFromDiff

patchNewFromDiff Source #

Arguments

:: (HasCallStack, MonadIO m, IsDiff a) 
=> a

diff: a tDiff.

-> Word32

idx: index into diff list.

-> m (Maybe Patch)

Returns: a newly created tPatch or Nothing. (Can throw GError)

The tPatch is a newly created object contains the text diffs for the delta. You have to call patchUnref when you are done with it. You can use the patch object to loop over all the hunks and lines in the diff of the one delta.

ref

patchRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m (Maybe Patch)

Returns: a tPatch or Nothing.

Atomically increments the reference count of patch by one. This function is MT-safe and may be called from any thread.

toStream

patchToStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsOutputStream a) 
=> Patch

patch: a tPatch.

-> a

stream: a tOutputStream.

-> m ()

(Can throw GError)

Write the contents of a patch to the provided stream.

toString

patchToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m (Maybe Text)

Returns: the content of a patch as a single diff text or Nothing. (Can throw GError)

Gets the content of a patch as a single diff text.

unref

patchUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a tPatch.

-> m () 

Atomically decrements the reference count of patch by one. If the reference count drops to 0, patch is freed.