| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Ggit.Structs.Patch
Contents
Description
Represents a patch object.
- newtype Patch = Patch (ManagedPtr Patch)
- noPatch :: Maybe Patch
- patchGetDelta :: (HasCallStack, MonadIO m) => Patch -> m DiffDelta
- patchGetHunk :: (HasCallStack, MonadIO m) => Patch -> Word64 -> m DiffHunk
- patchGetLineStats :: (HasCallStack, MonadIO m) => Patch -> m (Word64, Word64, Word64)
- patchGetNumHunks :: (HasCallStack, MonadIO m) => Patch -> m Word64
- patchGetNumLinesInHunk :: (HasCallStack, MonadIO m) => Patch -> Word64 -> m Int32
- patchNewFromBlobs :: (HasCallStack, MonadIO m, IsBlob a, IsBlob b, IsDiffOptions c) => Maybe a -> Maybe Text -> Maybe b -> Maybe Text -> Maybe c -> m Patch
- patchNewFromDiff :: (HasCallStack, MonadIO m, IsDiff a) => a -> Word64 -> m Patch
- patchRef :: (HasCallStack, MonadIO m) => Patch -> m Patch
- patchToStream :: (HasCallStack, MonadIO m, IsOutputStream a) => Patch -> a -> m ()
- patchToString :: (HasCallStack, MonadIO m) => Patch -> m Text
- patchUnref :: (HasCallStack, MonadIO m) => Patch -> m ()
Exported types
Methods
getDelta
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> m DiffDelta | Returns: the |
Get the diff delta corresponding to the patch.
getHunk
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> Word64 |
|
| -> m DiffHunk | Returns: a new |
Get the idx'th hunk in the patch.
getLineStats
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> m (Word64, Word64, Word64) | (Can throw |
Get the line statistics of the patch.
getNumHunks
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> m Word64 | Returns: the number of hunks. |
Get the number of hunks in the patch.
getNumLinesInHunk
patchGetNumLinesInHunk Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> Word64 |
|
| -> m Int32 | Returns: the number of lines. |
Get the number of lines in hunk.
newFromBlobs
Arguments
| :: (HasCallStack, MonadIO m, IsBlob a, IsBlob b, IsDiffOptions c) | |
| => Maybe a |
|
| -> Maybe Text |
|
| -> Maybe b |
|
| -> Maybe Text |
|
| -> Maybe c |
|
| -> m Patch | (Can throw |
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
Arguments
| :: (HasCallStack, MonadIO m, IsDiff a) | |
| => a |
|
| -> Word64 |
|
| -> m Patch |
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
Atomically increments the reference count of patch by one.
This function is MT-safe and may be called from any thread.
toStream
Arguments
| :: (HasCallStack, MonadIO m, IsOutputStream a) | |
| => Patch |
|
| -> a |
|
| -> m () | (Can throw |
Write the contents of a patch to the provided stream.
toString
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> m Text | Returns: the content of a patch as a single diff text. (Can throw |
Gets the content of a patch as a single diff text.
unref
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Patch |
|
| -> m () |
Atomically decrements the reference count of patch by one.
If the reference count drops to 0, patch is freed.