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

Commit13b38ce

Browse files
committed
Add type to symbolicreference.reference()
1 parentd4d4669 commit13b38ce

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

‎git/refs/head.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self, repo: 'Repo', path: PathLike = _HEAD_NAME):
4040
raiseValueError("HEAD instance must point to %r, got %r"% (self._HEAD_NAME,path))
4141
super(HEAD,self).__init__(repo,path)
4242
self.commit:'Commit'
43+
self.ref:'Head'
4344

4445
deforig_head(self)->SymbolicReference:
4546
"""

‎git/refs/symbolic.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class SymbolicReference(object):
6565
def__init__(self,repo:'Repo',path:PathLike,check_path:bool=False):
6666
self.repo=repo
6767
self.path=path
68+
self.ref=self.reference
6869

6970
def__str__(self)->str:
7071
returnstr(self.path)
@@ -282,7 +283,7 @@ def set_object(self, object: Union[Commit_ish, 'SymbolicReference', str], logmsg
282283
commit=property(_get_commit,set_commit,doc="Query or set commits directly")# type: ignore
283284
object=property(_get_object,set_object,doc="Return the object our ref currently refers to")# type: ignore
284285

285-
def_get_reference(self)->'SymbolicReference':
286+
def_get_reference(self)->'Reference':
286287
""":return: Reference Object we point to
287288
:raise TypeError: If this symbolic reference is detached, hence it doesn't point
288289
to a reference, but to a commit"""
@@ -362,8 +363,15 @@ def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str],
362363
returnself
363364

364365
# aliased reference
365-
reference=property(_get_reference,set_reference,doc="Returns the Reference we point to")# type: ignore
366-
ref:Union['Reference']=reference# type: ignore
366+
# reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
367+
368+
@property
369+
defreference(self)->'Reference':
370+
returnself._get_reference()
371+
372+
@reference.setter
373+
defreference(self,*args,**kwargs):
374+
returnself.set_reference(*args,**kwargs)
367375

368376
defis_valid(self)->bool:
369377
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp