Top | Description | Object Hierarchy | ![]() |
![]() |
![]() |
![]() |
GgitPatch; GgitDiffDelta * ggit_patch_get_delta (GgitPatch *patch
); GgitDiffHunk * ggit_patch_get_hunk (GgitPatch *patch
,gsize idx
,GError **error
); gboolean ggit_patch_get_line_stats (GgitPatch *patch
,gsize *total_context
,gsize *total_additions
,gsize *total_deletions
,GError **error
); gsize ggit_patch_get_num_hunks (GgitPatch *patch
); gint ggit_patch_get_num_lines_in_hunk (GgitPatch *patch
,gsize hunk
); GgitPatch * ggit_patch_new_from_blobs (GgitBlob *old_blob
,const gchar *old_as_path
,GgitBlob *new_blob
,const gchar *new_as_path
,GgitDiffOptions *diff_options
,GError **error
); GgitPatch * ggit_patch_new_from_diff (GgitDiff *diff
,gsize idx
,GError **error
); GgitPatch * ggit_patch_ref (GgitPatch *patch
); gboolean ggit_patch_to_stream (GgitPatch *patch
,GOutputStream *stream
,GError **error
); gchar * ggit_patch_to_string (GgitPatch *patch
,GError **error
); void ggit_patch_unref (GgitPatch *patch
);
GgitDiffDelta * ggit_patch_get_delta (GgitPatch *patch
);
Get the diff delta corresponding to the patch.
|
a GgitPatch. |
Returns : |
the GgitDiffDelta of the patch. [transfer full] |
GgitDiffHunk * ggit_patch_get_hunk (GgitPatch *patch
,gsize idx
,GError **error
);
Get the idx
'th hunk in the patch.
|
a GgitPatch |
|
the hunk index. |
|
a GError |
Returns : |
a new GgitDiffHunk or NULL on error. [transfer full]
|
gboolean ggit_patch_get_line_stats (GgitPatch *patch
,gsize *total_context
,gsize *total_additions
,gsize *total_deletions
,GError **error
);
Get the line statistics of the patch.
|
a GgitPatch. |
|
return value for the number of context lines. [allow-none][out] |
|
return value for the number of added lines. [allow-none][out] |
|
return value for the number of deleted lines. [allow-none][out] |
|
a GError. |
Returns : |
TRUE if successfull, FALSE otherwise. |
gsize ggit_patch_get_num_hunks (GgitPatch *patch
);
Get the number of hunks in the patch.
|
a GgitPatch. |
Returns : |
the number of hunks. |
gint ggit_patch_get_num_lines_in_hunk (GgitPatch *patch
,gsize hunk
);
Get the number of lines in hunk
.
|
a GgitPatch. |
|
the hunk index. |
Returns : |
the number of lines. |
GgitPatch * ggit_patch_new_from_blobs (GgitBlob *old_blob
,const gchar *old_as_path
,GgitBlob *new_blob
,const gchar *new_as_path
,GgitDiffOptions *diff_options
,GError **error
);
Directly generate a patch from the difference between two blobs.
This is just like ggit_diff_blobs()
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.
|
a GgitBlob to diff from. [allow-none] |
|
treat old_blob as if it had this filename, or NULL ,. [allow-none]
|
|
a GgitBlob to diff to. [allow-none] |
|
treat new_blob as if it had this filename, or NULL ,. [allow-none]
|
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
GgitPatch * ggit_patch_new_from_diff (GgitDiff *diff
,gsize idx
,GError **error
);
The GgitPatch is a newly created object contains the text diffs
for the delta. You have to call ggit_patch_unref()
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.
GgitPatch * ggit_patch_ref (GgitPatch *patch
);
Atomically increments the reference count of patch
by one.
This function is MT-safe and may be called from any thread.
gboolean ggit_patch_to_stream (GgitPatch *patch
,GOutputStream *stream
,GError **error
);
Write the contents of a patch to the provided stream.
|
a GgitPatch. |
|
a GOutputStream. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if the patch was written successfully, FALSE otherwise. |
gchar * ggit_patch_to_string (GgitPatch *patch
,GError **error
);
Gets the content of a patch as a single diff text.
|
a GgitPatch. |
|
a GError for error reporting, or NULL . |
Returns : |
the content of a patch as a single diff text. |