gi-ggit-1.0.7: libgit2-glib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
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
BoxedObject Patch Source # 
Instance details

Defined in GI.Ggit.Structs.Patch

Methods

boxedType :: Patch -> IO GType #

noPatch :: Maybe Patch Source #

A convenience alias for Nothing :: Maybe Patch.

Methods

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.