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

Commite8442ee

Browse files
committed
Add type to symbolicreference.set_reference()
1 parent7f401fc commite8442ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎git/refs/symbolic.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ def _get_reference(self):
289289
raiseTypeError("%s is a detached symbolic reference as it points to %r"% (self,sha))
290290
returnself.from_path(self.repo,target_ref_path)
291291

292-
defset_reference(self,ref,logmsg=None):
292+
defset_reference(self,ref:Union[Commit_ish,'SymbolicReference',str],
293+
logmsg:Union[str,None]=None)->Union[Commit_ish,'SymbolicReference']:
293294
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
294295
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
295296
will be set which effectively detaches the refererence if it was a purely
@@ -330,7 +331,7 @@ def set_reference(self, ref, logmsg=None):
330331
raiseTypeError("Require commit, got %r"%obj)
331332
# END verify type
332333

333-
oldbinsha=None
334+
oldbinsha:bytes=b''
334335
iflogmsgisnotNone:
335336
try:
336337
oldbinsha=self.commit.binsha
@@ -359,8 +360,8 @@ def set_reference(self, ref, logmsg=None):
359360
returnself
360361

361362
# aliased reference
362-
reference=property(_get_reference,set_reference,doc="Returns the Reference we point to")
363-
ref:Union['Reference']=reference# type: ignore
363+
reference=property(_get_reference,set_reference,doc="Returns the Reference we point to")# type: ignore
364+
ref:Union['Reference']=reference# type: ignore
364365

365366
defis_valid(self)->bool:
366367
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp