gi-ggit-1.0.11: libgit2-glib bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Ggit.Structs.Patch

Description

Represents a patch object.

Synopsis

Exported types

newtype Patch Source #

Memory-managed wrapper type.

Constructors

Patch (ManagedPtr Patch) 

Instances

Instances details
Eq Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

Methods

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

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

GBoxed Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

ManagedPtrNewtype Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

TypedObject Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

Methods

glibType :: IO GType #

HasParentTypes Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

IsGValue (Maybe Patch) Source #

Convert Patch to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Ggit.Structs.Patch

type ParentTypes Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

type ParentTypes Patch = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

ref, toStream, toString, unref.

Getters

getDelta, getHunk, getLineStats, getNumHunks, getNumLinesInHunk.

Setters

None.

getDelta

patchGetDelta Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a Patch.

-> m (Maybe DiffDelta)

Returns: the DiffDelta of the patch or Nothing.

Get the diff delta corresponding to the patch.

getHunk

patchGetHunk Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a Patch

-> Word64

idx: the hunk index.

-> m (Maybe DiffHunk)

Returns: a new DiffHunk 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 Patch.

-> m (Word64, Word64, Word64)

(Can throw GError)

Get the line statistics of the patch.

getNumHunks

patchGetNumHunks Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a Patch.

-> m Word64

Returns: the number of hunks.

Get the number of hunks in the patch.

getNumLinesInHunk

patchGetNumLinesInHunk Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a Patch.

-> Word64

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 Blob to diff from.

-> Maybe Text

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

-> Maybe b

newBlob: a Blob to diff to.

-> Maybe Text

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

-> Maybe c

diffOptions: a DiffOptions, or Nothing.

-> m (Maybe Patch)

Returns: a newly created Patch 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 Diff.

-> Word64

idx: index into diff list.

-> m (Maybe Patch)

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

The Patch 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 Patch.

-> m (Maybe Patch)

Returns: a Patch 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 Patch.

-> a

stream: a OutputStream.

-> m ()

(Can throw GError)

Write the contents of a patch to the provided stream.

toString

patchToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Patch

patch: a Patch.

-> 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 Patch.

-> m () 

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