@@ -84,8 +84,9 @@ class Diffable:
8484 compatible type.
8585
8686 :note:
87- Subclasses require a repo member as it is the case for Object instances, for
88- practical reasons we do not derive from Object.
87+ Subclasses require a repo member as it is the case for
88+ :class:`~git.objects.base.Object` instances, for practical reasons we do not
89+ derive from :class:`~git.objects.base.Object`.
8990 """
9091
9192__slots__ = ()
@@ -111,37 +112,38 @@ def diff(
111112create_patch :bool = False ,
112113** kwargs :Any ,
113114 )-> "DiffIndex" :
114- """Create diffs between two items being trees, trees and index or an
115- index and the working tree. Detects renames automatically.
115+ """Create diffs between two items being trees, trees and index or an index and
116+ the working tree. Detects renames automatically.
116117
117118 :param other:
118119 This the item to compare us with.
119120
120- * If None, we will be compared to the working tree.
121+ * If`` None`` , we will be compared to the working tree.
121122 * If :class:`~git.index.base.Treeish`, it will be compared against the
122123 respective tree.
123- * If :class:`~ Diffable.Index`, it will be compared against the index.
124+ * If :class:`Diffable.Index`, it will be compared against the index.
124125 * If :attr:`git.NULL_TREE`, it will compare against the empty tree.
125- * It defaults to :class:`~ Diffable.Index` so that the method will not by
126+ * It defaults to :class:`Diffable.Index` so that the method will not by
126127 default fail on bare repositories.
127128
128129 :param paths:
129130 This a list of paths or a single path to limit the diff to. It will only
130131 include at least one of the given path or paths.
131132
132133 :param create_patch:
133- If True, the returned :class:`Diff` contains a detailed patch that if
134+ If`` True`` , the returned :class:`Diff` contains a detailed patch that if
134135 applied makes the self to other. Patches are somewhat costly as blobs have
135136 to be read and diffed.
136137
137138 :param kwargs:
138- Additional arguments passed to git- diff, such as ``R=True`` to swap both
139+ Additional arguments passed to`` git diff`` , such as ``R=True`` to swap both
139140 sides of the diff.
140141
141- :return: git.DiffIndex
142+ :return:
143+ :class:`DiffIndex`
142144
143145 :note:
144- On a bare repository,' other' needs to be provided as
146+ On a bare repository,` other` needs to be provided as
145147 :class:`~Diffable.Index`, or as :class:`~git.objects.tree.Tree` or
146148 :class:`~git.objects.commit.Commit`, or a git command error will occur.
147149 """
@@ -184,7 +186,7 @@ def diff(
184186
185187args .insert (0 ,self )
186188
187- # paths is list here, or None.
189+ # paths isa list here, or None.
188190if paths :
189191args .append ("--" )
190192args .extend (paths )
@@ -204,7 +206,7 @@ def diff(
204206
205207
206208class DiffIndex (List [T_Diff ]):
207- """An Index for diffs, allowing a list ofDiffs to be queried by the diff
209+ R """An Index for diffs, allowing a list of:class:`Diff`\s to be queried by the diff
208210 properties.
209211
210212 The class improves the diff handling convenience.
@@ -256,34 +258,34 @@ def iter_change_type(self, change_type: Lit_change_type) -> Iterator[T_Diff]:
256258class Diff :
257259"""A Diff contains diff information between two Trees.
258260
259- It contains two sides a and b of the diff, members are prefixed with
260- "a" and "b" respectively to indicate that.
261+ It contains two sides a and b of the diff. Members are prefixed with "a" and "b"
262+ respectively to indicate that.
261263
262264 Diffs keep information about the changed blob objects, the file mode, renames,
263265 deletions and new files.
264266
265- There are a few cases where None has to be expected as member variable value:
267+ There are a few cases where`` None`` has to be expected as member variable value:
266268
267- `` New File`` ::
269+ New File::
268270
269271 a_mode is None
270272 a_blob is None
271273 a_path is None
272274
273- `` Deleted File`` ::
275+ Deleted File::
274276
275277 b_mode is None
276278 b_blob is None
277279 b_path is None
278280
279- `` Working Tree Blobs``
281+ Working Tree Blobs:
280282
281283 When comparing to working trees, the working tree blob will have a null hexsha
282- as a corresponding object does not yet exist. The mode will be null as well.
283- The path will be available, though.
284+ as a corresponding object does not yet exist. The mode will be null as well. The
285+ path will be available, though.
284286
285- If it is listed in a diff, the working tree version of the file must
286- differ from the version in the index or tree, and hence has been modified.
287+ If it is listed in a diff, the working tree version of the file must differ from
288+ the version in the index or tree, and hence has been modified.
287289 """
288290
289291# Precompiled regex.
@@ -467,17 +469,20 @@ def rename_to(self) -> Optional[str]:
467469
468470@property
469471def renamed (self )-> bool :
470- """
471- :return: True if the blob of our diff has been renamed
472+ """Deprecated, use :attr:`renamed_file` instead.
473+
474+ :return:
475+ ``True`` if the blob of our diff has been renamed
472476
473- :note: This property is deprecated.
477+ :note:
478+ This property is deprecated.
474479 Please use the :attr:`renamed_file` property instead.
475480 """
476481return self .renamed_file
477482
478483@property
479484def renamed_file (self )-> bool :
480- """:return: True if the blob of our diff has been renamed"""
485+ """:return:`` True`` if the blob of our diff has been renamed"""
481486return self .rename_from != self .rename_to
482487
483488@classmethod
@@ -495,11 +500,18 @@ def _pick_best_path(cls, path_match: bytes, rename_match: bytes, path_fallback_m
495500
496501@classmethod
497502def _index_from_patch_format (cls ,repo :"Repo" ,proc :Union ["Popen" ,"Git.AutoInterrupt" ])-> DiffIndex :
498- """Create a new DiffIndex from the given process output which must be in patch format.
503+ """Create a new :class:`DiffIndex` from the given process output which must be
504+ in patch format.
505+
506+ :param repo:
507+ The repository we are operating on.
499508
500- :param repo: The repository we are operating on
501- :param proc: ``git diff`` process to read from (supports :class:`Git.AutoInterrupt` wrapper)
502- :return: git.DiffIndex
509+ :param proc:
510+ ``git diff`` process to read from
511+ (supports :class:`Git.AutoInterrupt <git.cmd.Git.AutoInterrupt>` wrapper).
512+
513+ :return:
514+ :class:`DiffIndex`
503515 """
504516
505517# FIXME: Here SLURPING raw, need to re-phrase header-regexes linewise.
@@ -540,14 +552,14 @@ def _index_from_patch_format(cls, repo: "Repo", proc: Union["Popen", "Git.AutoIn
540552a_path = cls ._pick_best_path (a_path ,rename_from ,a_path_fallback )
541553b_path = cls ._pick_best_path (b_path ,rename_to ,b_path_fallback )
542554
543- # Our only means to find the actual text is to see what has not been matched by our regex,
544- # and then retro-actively assign it to our index.
555+ # Our only means to find the actual text is to see what has not been matched
556+ #by our regex, and then retro-actively assign it to our index.
545557if previous_header is not None :
546558index [- 1 ].diff = text [previous_header .end () :_header .start ()]
547559# END assign actual diff
548560
549- # Make sure the mode is set if the path is set. Otherwise the resulting blob is invalid.
550- # We just use the one mode we should have parsed.
561+ # Make sure the mode is set if the path is set. Otherwise the resulting blob
562+ #is invalid. We just use the one mode we should have parsed.
551563a_mode = old_mode or deleted_file_mode or (a_path and (b_mode or new_mode or new_file_mode ))
552564b_mode = b_mode or new_mode or new_file_mode or (b_path and a_mode )
553565index .append (
@@ -611,7 +623,7 @@ def _handle_diff_line(lines_bytes: bytes, repo: "Repo", index: DiffIndex) -> Non
611623rename_from = None
612624rename_to = None
613625
614- # NOTE: We cannot conclude from the existence of a blob to change type
626+ # NOTE: We cannot conclude from the existence of a blob to change type,
615627# as diffs with the working do not have blobs yet.
616628if change_type == "D" :
617629b_blob_id = None # Optional[str]
@@ -655,11 +667,17 @@ def _handle_diff_line(lines_bytes: bytes, repo: "Repo", index: DiffIndex) -> Non
655667
656668@classmethod
657669def _index_from_raw_format (cls ,repo :"Repo" ,proc :"Popen" )-> "DiffIndex" :
658- """Create a new DiffIndex from the given process output which must be in raw format.
670+ """Create a new :class:`DiffIndex` from the given process output which must be
671+ in raw format.
672+
673+ :param repo:
674+ The repository we are operating on.
659675
660- :param repo: The repository we are operating on
661- :param proc: Process to read output from
662- :return: git.DiffIndex
676+ :param proc:
677+ Process to read output from.
678+
679+ :return:
680+ :class:`DiffIndex`
663681 """
664682# handles
665683# :100644 100644 687099101... 37c5e30c8... M .gitignore