44# This module is part of GitPython and is released under
55# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66"""Module containing Index implementation, allowing to perform all kinds of index
7- manipulations such as querying and merging. """
7+ manipulations such as querying and merging."""
88import tempfile
99import os
1010import sys
7575
7676
7777class IndexFile (LazyMixin , diff .Diffable , Serializable ):
78- """Implements an Index that can be manipulated using a native implementation in
78+ """
79+ Implements an Index that can be manipulated using a native implementation in
7980 order to save git command function calls wherever possible.
80-
81+
8182 It provides custom merging facilities allowing to merge without actually changing
8283 your index or your working tree. This way you can perform own test-merges based
8384 on the index only without having to deal with the working copy. This is useful
8485 in case of partial working trees.
8586
8687 ``Entries``
88+
8789 The index contains an entries dict whose keys are tuples of type IndexEntry
8890 to facilitate access.
8991
9092 You may read the entries dict or manipulate it using IndexEntry instance, i.e.::
93+
9194 index.entries[index.entry_key(index_entry_instance)] = index_entry_instance
92- Otherwise changes to it will be lost when changing the index using its methods.
93- """
95+
96+ Make sure you use index.write() once you are done manipulating the index directly
97+ before operating on it using the git command"""
9498 __slots__ = ("repo" , "version" , "entries" , "_extension_data" , "_file_path" )
9599 _VERSION = 2 # latest version we support
96100 S_IFGITLINK = 0160000 # a submodule
@@ -250,7 +254,7 @@ def new(cls, repo, *tree_sha):
250254
251255 :param repo: The repository treeish are located in.
252256
253- :param * tree_sha:
257+ :param tree_sha:
254258 20 byte or 40 byte tree sha or tree objects
255259
256260 :return:
@@ -276,7 +280,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
276280 :param repo:
277281 The repository treeish are located in.
278282
279- :param * treeish:
283+ :param treeish:
280284 One, two or three Tree Objects, Commits or 40 byte hexshas. The result
281285 changes according to the amount of trees.
282286 If 1 Tree is given, it will just be read into a new index
@@ -287,7 +291,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
287291 being the common ancestor of tree 2 and tree 3. Tree 2 is the 'current' tree,
288292 tree 3 is the 'other' one
289293
290- :param ** kwargs:
294+ :param kwargs:
291295 Additional arguments passed to git-read-tree
292296
293297 :return:
@@ -790,7 +794,7 @@ def remove(self, items, working_tree=False, **kwargs):
790794 removing the respective file. This may fail if there are uncommited changes
791795 in it.
792796
793- :param ** kwargs:
797+ :param kwargs:
794798 Additional keyword arguments to be passed to git-rm, such
795799 as 'r' to allow recurive removal of
796800
@@ -828,7 +832,7 @@ def move(self, items, skip_errors=False, **kwargs):
828832 :param skip_errors:
829833 If True, errors such as ones resulting from missing source files will
830834 be skpped.
831- :param ** kwargs:
835+ :param kwargs:
832836 Additional arguments you would like to pass to git-mv, such as dry_run
833837 or force.
834838
@@ -924,7 +928,7 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar
924928 explicit paths are given. Otherwise progress information will be send
925929 prior and after a file has been checked out
926930
927- :param ** kwargs:
931+ :param kwargs:
928932 Additional arguments to be pasesd to git-checkout-index
929933
930934 :return:
0 commit comments