4
4
# This module is part of GitPython and is released under
5
5
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6
6
"""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."""
8
8
import tempfile
9
9
import os
10
10
import sys
75
75
76
76
77
77
class 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
79
80
order to save git command function calls wherever possible.
80
-
81
+
81
82
It provides custom merging facilities allowing to merge without actually changing
82
83
your index or your working tree. This way you can perform own test-merges based
83
84
on the index only without having to deal with the working copy. This is useful
84
85
in case of partial working trees.
85
86
86
87
``Entries``
88
+
87
89
The index contains an entries dict whose keys are tuples of type IndexEntry
88
90
to facilitate access.
89
91
90
92
You may read the entries dict or manipulate it using IndexEntry instance, i.e.::
93
+
91
94
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"""
94
98
__slots__ = ("repo" , "version" , "entries" , "_extension_data" , "_file_path" )
95
99
_VERSION = 2 # latest version we support
96
100
S_IFGITLINK = 0160000 # a submodule
@@ -250,7 +254,7 @@ def new(cls, repo, *tree_sha):
250
254
251
255
:param repo: The repository treeish are located in.
252
256
253
- :param * tree_sha:
257
+ :param tree_sha:
254
258
20 byte or 40 byte tree sha or tree objects
255
259
256
260
:return:
@@ -276,7 +280,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
276
280
:param repo:
277
281
The repository treeish are located in.
278
282
279
- :param * treeish:
283
+ :param treeish:
280
284
One, two or three Tree Objects, Commits or 40 byte hexshas. The result
281
285
changes according to the amount of trees.
282
286
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):
287
291
being the common ancestor of tree 2 and tree 3. Tree 2 is the 'current' tree,
288
292
tree 3 is the 'other' one
289
293
290
- :param ** kwargs:
294
+ :param kwargs:
291
295
Additional arguments passed to git-read-tree
292
296
293
297
:return:
@@ -790,7 +794,7 @@ def remove(self, items, working_tree=False, **kwargs):
790
794
removing the respective file. This may fail if there are uncommited changes
791
795
in it.
792
796
793
- :param ** kwargs:
797
+ :param kwargs:
794
798
Additional keyword arguments to be passed to git-rm, such
795
799
as 'r' to allow recurive removal of
796
800
@@ -828,7 +832,7 @@ def move(self, items, skip_errors=False, **kwargs):
828
832
:param skip_errors:
829
833
If True, errors such as ones resulting from missing source files will
830
834
be skpped.
831
- :param ** kwargs:
835
+ :param kwargs:
832
836
Additional arguments you would like to pass to git-mv, such as dry_run
833
837
or force.
834
838
@@ -924,7 +928,7 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar
924
928
explicit paths are given. Otherwise progress information will be send
925
929
prior and after a file has been checked out
926
930
927
- :param ** kwargs:
931
+ :param kwargs:
928
932
Additional arguments to be pasesd to git-checkout-index
929
933
930
934
:return:
0 commit comments