Ggit.Diff

g GObject.Object GObject.Object Ggit.ObjectFactoryBase Ggit.ObjectFactoryBase GObject.Object->Ggit.ObjectFactoryBase Ggit.Diff Ggit.Diff Ggit.Native Ggit.Native Ggit.Native->Ggit.Diff Ggit.ObjectFactoryBase->Ggit.Native

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class blob_to_buffer (old_blob, old_as_path, buffer, buffer_as_path, diff_options, file_cb, binary_cb, hunk_cb, line_cb, *user_data)
class blobs (old_blob, old_as_path, new_blob, new_as_path, diff_options, file_cb, binary_cb, hunk_cb, line_cb, *user_data)
class new_buffers (buffer1, buffer1_as_path, buffer2, buffer2_as_path, diff_options)
class new_index_to_workdir (repository, index, diff_options)
class new_tree_to_index (repository, old_tree, index, diff_options)
class new_tree_to_tree (repository, old_tree, new_tree, diff_options)
class new_tree_to_workdir (repository, old_tree, diff_options)
  find_similar (options)
  foreach (file_cb, binary_cb, hunk_cb, line_cb, *user_data)
  format_email (options)
  get_delta (index)
  get_num_deltas ()
  merge (from_)
  print_ (type, print_cb, *user_data)

Virtual Methods

Inherited:GObject.Object (7)

Properties

Inherited:Ggit.Native (1)
Name Type Flags Short Description
repository Ggit.Repository r/w/co Repository

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance Ggit.Native r  

Class Details

class Ggit.Diff(**kwargs)
Bases:Ggit.Native
Abstract:No
Structure:Ggit.DiffClass

Represents a diff list.

classmethod blob_to_buffer(old_blob, old_as_path, buffer, buffer_as_path, diff_options, file_cb, binary_cb, hunk_cb, line_cb, *user_data)
Parameters:
Raises:

GLib.Error

Same as Ggit.Diff.blobs() but using a buffer.

classmethod blobs(old_blob, old_as_path, new_blob, new_as_path, diff_options, file_cb, binary_cb, hunk_cb, line_cb, *user_data)
Parameters:
Raises:

GLib.Error

Iterates over the diff calling file_cb, binary_cb, hunk_cb and line_cb.

The Ggit.DiffFile mode always be 0, path will be None and when a blob is None the oid will be 0.

If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

classmethod new_buffers(buffer1, buffer1_as_path, buffer2, buffer2_as_path, diff_options)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated Ggit.Diff if there was no error, None otherwise.

Return type:

Ggit.Diff or None

Same as Ggit.Diff.blobs() but using a buffers. Creates a Ggit.Diff which compares buffer1 and buffer2.

If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

classmethod new_index_to_workdir(repository, index, diff_options)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated Ggit.Diff if there was no error, None otherwise.

Return type:

Ggit.Diff or None

Creates a Ggit.Diff which compares the working directory and the index.

If index is None then repository index is used. If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

classmethod new_tree_to_index(repository, old_tree, index, diff_options)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated Ggit.Diff if there was no error, None otherwise.

Return type:

Ggit.Diff or None

Creates a Ggit.Diff which compares old_tree and the index.

If index is None then repository index is used. If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

classmethod new_tree_to_tree(repository, old_tree, new_tree, diff_options)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated Ggit.Diff if there was no error, None otherwise.

Return type:

Ggit.Diff or None

Creates a Ggit.Diff which compares old_tree and new_tree.

If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

classmethod new_tree_to_workdir(repository, old_tree, diff_options)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated Ggit.Diff if there was no error, None otherwise.

Return type:

Ggit.Diff or None

Creates a Ggit.Diff which compares the working directory and old_tree.

If diff_options is None then the defaults specified in Ggit.DiffOptions.new() are used.

find_similar(options)
Parameters:options (Ggit.DiffFindOptions or None) – a Ggit.DiffFindOptions or None.
Raises:GLib.Error
Returns:True if there were no errors, False otherwise.
Return type:bool

Transform self marking file renames, copies, etc.. If options is set to None, then the default options will be used.

foreach(file_cb, binary_cb, hunk_cb, line_cb, *user_data)
Parameters:
Raises:

GLib.Error

Iterates over the diff calling file_cb, binary_cb, hunk_cb and line_cb.

format_email(options)
Parameters:options (Ggit.DiffFormatEmailOptions) – a Ggit.DiffFormatEmailOptions.
Raises:GLib.Error
Returns:the patch or None if an error occurred.
Return type:str or None

Create an e-mail ready patch from a diff.

get_delta(index)
Parameters:index (int) – the index.
Returns:a Ggit.DiffDelta or None.
Return type:Ggit.DiffDelta or None

Get the delta at the specified index.

get_num_deltas()
Returns:the number of deltas.
Return type:int

Get the number of deltas in the diff.

merge(from_)
Parameters:from (Ggit.Diff) – the Ggit.Diff to merge.
Raises:GLib.Error

Merges from into self unless error is set.

print_(type, print_cb, *user_data)
Parameters:
Raises:

GLib.Error

Iterates over self generating text output like “git diff”.

Property Details

Ggit.Diff.props.repository
Name:repository
Type:Ggit.Repository
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

Repository