Ggit.Index¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
File |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Ggit.Index(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Represents an index object.
- classmethod open(file)¶
- Parameters:
- Raises:
- Returns:
a
Ggit.Index
orNone
if an error occurred.- Return type:
Ggit.Index
orNone
Create a new bare Git index object as a memory representation of the Git index file in file, without a repository to back it.
- add(entry)¶
- Parameters:
entry (
Ggit.IndexEntry
) – aGgit.IndexEntry
.- Raises:
- Returns:
- Return type:
Add a file to the index.
- add_file(file)¶
- Parameters:
file (
Gio.File
) – file to add.- Raises:
- Returns:
True
if the file was added to the index orFalse
if there was an error.- Return type:
Add a file to the index. The specified file must be in the working directory and must exist and be readable.
- add_path(path)¶
- Parameters:
path (
str
) – path to the file to add.- Raises:
- Returns:
True
if the file was added to the index orFalse
if there was an error.- Return type:
Add a file to the index by path. You can specify both relative paths (to the working directory) and absolute paths. Absolute paths however must reside in the working directory. The specified path must exist and must be readable.
- get_entries()¶
- Returns:
a
Ggit.IndexEntries
orNone
.- Return type:
Get the index entries enumerator.
- get_entries_resolve_undo()¶
- Returns:
- Return type:
Get the resolve undo entries enumerator.
- get_owner()¶
- Returns:
the
Ggit.Repository
that owns this index orNone
.- Return type:
Get the
Ggit.Repository
that owns the index.
- has_conflicts()¶
-
Get whether the index has any conflicts.
- read(force)¶
- Parameters:
force (
bool
) – force read even if there are in-memory changes.- Raises:
- Returns:
True
if the index could be read from the file associated with the index,False
otherwise.- Return type:
Update the contents of an existing index object in memory by reading from the hard disk.
If force is true, this performs a “hard” read that discards in-memory changes and always reloads the on-disk index data. If there is no on-disk version, the index will be cleared.
If force is false, this does a “soft” read that reloads the index data from disk only if it has changed since the last time it was loaded. Purely in-memory index data will be untouched. Be aware: if there are changes on disk, unwritten in-memory changes are discarded.
- remove(file, stage)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Remove a file from the index (specified by position).
- write()¶
-
Write an existing index object from memory back to disk using an atomic file lock.
- write_tree()¶
- Raises:
- Returns:
- Return type:
Write a new tree object to disk containing a representation of the current state of the index. The index must be associated to an existing repository and must not contain any files in conflict. You can use the resulting tree to for instance create a commit.
- write_tree_to(repository)¶
- Parameters:
repository (
Ggit.Repository
) – aGgit.Repository
.- Raises:
- Returns:
- Return type:
Write a new tree object to repository containing a representation of the current state of the index. The index must not contain any files in conflict. You can use the resulting tree to for instance create a commit.