Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9952e1

Browse files
committed
Fix Sphinx references; give Diffable.Index a docstring
1 parent65863a2 commitc9952e1

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

‎git/diff.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,30 @@ class Diffable:
149149
:const:`git.NULL_TREE` and :const:`git.diff.NULL_TREE`.
150150
"""
151151

152-
INDEX=Index=INDEX
152+
INDEX=INDEX
153153
"""Stand-in indicating you want to diff against the index.
154154
155155
See the :meth:`diff` method, which accepts this as a value of its ``other``
156156
parameter.
157157
158158
This is the same as :const:`DiffConstants.INDEX`, and may also be accessed as
159-
:const:`git.INDEX` and :const:`git.diff.INDEX`.
159+
:const:`git.INDEX` and :const:`git.diff.INDEX`, as well as :class:`Diffable.INDEX`,
160+
which is kept for backward compatibility (it is now defined an alias of this).
161+
"""
162+
163+
Index=INDEX
164+
"""Stand-in indicating you want to diff against the index
165+
(same as :const:`~Diffable.INDEX`).
166+
167+
This is an alias of :const:`~Diffable.INDEX`, for backward compatibility. See
168+
:const:`~Diffable.INDEX` and :meth:`diff` for details.
169+
170+
:note:
171+
Although always meant for use as an opaque constant, this was formerly defined
172+
as a class. Its usage is unchanged, but static type annotations that attempt
173+
to permit only this object must be changed to avoid new mypy errors. This was
174+
previously not possible to do, though ``Type[Diffable.Index]`` approximated it.
175+
It is now possible to do precisely, using ``Literal[DiffConstants.INDEX]``.
160176
"""
161177

162178
def_process_diff_args(
@@ -213,10 +229,9 @@ def diff(
213229
A :class:`DiffIndex` representing the computed diff.
214230
215231
:note:
216-
On a bare repository, `other` needs to be provided as
217-
:class:`~Diffable.Index`, or as an instance of
218-
:class:`~git.objects.tree.Tree` or :class:`~git.objects.commit.Commit`, or a
219-
git command error will occur.
232+
On a bare repository, `other` needs to be provided as :const:`INDEX`, or as
233+
an instance of :class:`~git.objects.tree.Tree` or
234+
:class:`~git.objects.commit.Commit`, or a git command error will occur.
220235
"""
221236
args:List[Union[PathLike,Diffable]]= []
222237
args.append("--abbrev=40")# We need full shas.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp