Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Represents a patch object.
Synopsis
- newtype Patch = Patch (ManagedPtr Patch)
- patchGetDelta :: (HasCallStack, MonadIO m) => Patch -> m (Maybe DiffDelta)
- patchGetHunk :: (HasCallStack, MonadIO m) => Patch -> Word64 -> m (Maybe 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 (Maybe Patch)
- patchNewFromDiff :: (HasCallStack, MonadIO m, IsDiff a) => a -> Word64 -> m (Maybe Patch)
- patchRef :: (HasCallStack, MonadIO m) => Patch -> m (Maybe Patch)
- patchToStream :: (HasCallStack, MonadIO m, IsOutputStream a) => Patch -> a -> m ()
- patchToString :: (HasCallStack, MonadIO m) => Patch -> m (Maybe Text)
- patchUnref :: (HasCallStack, MonadIO m) => Patch -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Patch Source # | |
GBoxed Patch Source # | |
Defined in GI.Ggit.Structs.Patch | |
ManagedPtrNewtype Patch Source # | |
Defined in GI.Ggit.Structs.Patch toManagedPtr :: Patch -> ManagedPtr Patch | |
TypedObject Patch Source # | |
Defined in GI.Ggit.Structs.Patch | |
HasParentTypes Patch Source # | |
Defined in GI.Ggit.Structs.Patch | |
IsGValue (Maybe Patch) Source # | Convert |
Defined in GI.Ggit.Structs.Patch gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Patch -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Patch) | |
type ParentTypes Patch Source # | |
Defined in GI.Ggit.Structs.Patch |
Methods
Click to display all available methods, including inherited ones
Methods
ref, toStream, toString, unref.
Getters
getDelta, getHunk, getLineStats, getNumHunks, getNumLinesInHunk.
Setters
None.
getDelta
Get the diff delta corresponding to the patch.
getHunk
:: (HasCallStack, MonadIO m) | |
=> Patch |
|
-> Word64 |
|
-> m (Maybe DiffHunk) | Returns: a new |
Get the idx
'th hunk in the patch.
getLineStats
Get the line statistics of the patch.
getNumHunks
:: (HasCallStack, MonadIO m) | |
=> Patch |
|
-> m Word64 | Returns: the number of hunks. |
Get the number of hunks in the patch.
getNumLinesInHunk
patchGetNumLinesInHunk Source #
:: (HasCallStack, MonadIO m) | |
=> Patch |
|
-> Word64 |
|
-> m Int32 | Returns: the number of lines. |
Get the number of lines in hunk
.
newFromBlobs
:: (HasCallStack, MonadIO m, IsBlob a, IsBlob b, IsDiffOptions c) | |
=> Maybe a |
|
-> Maybe Text |
|
-> Maybe b |
|
-> Maybe Text |
|
-> Maybe c |
|
-> m (Maybe Patch) | Returns: a newly created |
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
:: (HasCallStack, MonadIO m, IsDiff a) | |
=> a |
|
-> Word64 |
|
-> m (Maybe Patch) | Returns: a newly created |
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
:: (HasCallStack, MonadIO m, IsOutputStream a) | |
=> Patch |
|
-> a |
|
-> m () | (Can throw |
Write the contents of a patch to the provided stream.
toString
:: (HasCallStack, MonadIO m) | |
=> Patch |
|
-> m (Maybe Text) | Returns: the content of a patch as a single diff text or |
Gets the content of a patch as a single diff text.
unref
:: (HasCallStack, MonadIO m) | |
=> Patch |
|
-> m () |
Atomically decrements the reference count of patch
by one.
If the reference count drops to 0, patch
is freed.