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

Commit581d40d

Browse files
committed
Add type to symbolicreference.log_append()
1 parentafd2ec5 commit581d40d

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

‎git/refs/symbolic.py‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
ifTYPE_CHECKING:
2828
fromgit.repoimportRepo
2929
fromgit.refsimportHead,TagReference,Reference
30+
from .logimportRefLogEntry
31+
fromgit.configimportGitConfigParser
32+
fromgit.objects.commitimportActor
33+
3034

3135
T_References=TypeVar('T_References',bound='SymbolicReference')
3236

@@ -391,7 +395,8 @@ def log(self):
391395
instead of calling this method repeatedly. It should be considered read-only."""
392396
returnRefLog.from_file(RefLog.path(self))
393397

394-
deflog_append(self,oldbinsha,message,newbinsha=None):
398+
deflog_append(self,oldbinsha:bytes,message:Union[str,None],
399+
newbinsha:Union[bytes,None]=None)->'RefLogEntry':
395400
"""Append a logentry to the logfile of this ref
396401
397402
:param oldbinsha: binary sha this ref used to point to
@@ -403,15 +408,19 @@ def log_append(self, oldbinsha, message, newbinsha=None):
403408
# correct to allow overriding the committer on a per-commit level.
404409
# See https://github.com/gitpython-developers/GitPython/pull/146
405410
try:
406-
committer_or_reader=self.commit.committer
411+
committer_or_reader:Union['Actor','GitConfigParser']=self.commit.committer
407412
exceptValueError:
408413
committer_or_reader=self.repo.config_reader()
409414
# end handle newly cloned repositories
410-
returnRefLog.append_entry(committer_or_reader,RefLog.path(self),oldbinsha,
411-
(newbinshaisNoneandself.commit.binsha)ornewbinsha,
412-
message)
415+
ifnewbinshaisNone:
416+
newbinsha=self.commit.binsha
417+
418+
ifmessageisNone:
419+
message=''
420+
421+
returnRefLog.append_entry(committer_or_reader,RefLog.path(self),oldbinsha,newbinsha,message)
413422

414-
deflog_entry(self,index):
423+
deflog_entry(self,index:int)->'RefLogEntry':
415424
""":return: RefLogEntry at the given index
416425
:param index: python list compatible positive or negative index
417426

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp