@@ -136,23 +136,23 @@ def _iter_packed_refs(cls, repo: 'Repo') -> Iterator[Tuple[str, str]]:
136
136
# alright.
137
137
138
138
@classmethod
139
- def dereference_recursive (cls , repo : 'Repo' , ref_path : PathLike ) -> str :
139
+ def dereference_recursive (cls , repo , ref_path ) :
140
140
"""
141
141
:return: hexsha stored in the reference at the given ref_path, recursively dereferencing all
142
142
intermediate references as required
143
143
:param repo: the repository containing the reference at ref_path"""
144
144
while True :
145
- hexsha , _ref_path = cls ._get_ref_info (repo , ref_path )
145
+ hexsha , ref_path = cls ._get_ref_info (repo , ref_path )
146
146
if hexsha is not None :
147
147
return hexsha
148
148
# END recursive dereferencing
149
149
150
150
@classmethod
151
- def _get_ref_info_helper (cls , repo : 'Repo' , ref_path : PathLike ) -> Union [ Tuple [ str , None ], Tuple [ None , str ]] :
151
+ def _get_ref_info_helper (cls , repo , ref_path ) :
152
152
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
153
153
rela_path points to, or None. target_ref_path is the reference we
154
154
point to, or None"""
155
- tokens : Union [ Tuple [ str , str ], List [ str ], None ] = None
155
+ tokens = None
156
156
repodir = _git_dir (repo , ref_path )
157
157
try :
158
158
with open (os .path .join (repodir , ref_path ), 'rt' , encoding = 'UTF-8' ) as fp :
@@ -169,7 +169,7 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[s
169
169
if path != ref_path :
170
170
continue
171
171
# sha will be used
172
- tokens = ( sha , path )
172
+ tokens = sha , path
173
173
break
174
174
# END for each packed ref
175
175
# END handle packed refs
@@ -186,8 +186,8 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[s
186
186
187
187
raise ValueError ("Failed to parse reference information from %r" % ref_path )
188
188
189
- @ classmethod
190
- def _get_ref_info (cls , repo : 'Repo' , ref_path : PathLike ) -> Union [ Tuple [ str , None ], Tuple [ None , str ]] :
189
+ @classmethod
190
+ def _get_ref_info (cls , repo , ref_path ) :
191
191
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
192
192
rela_path points to, or None. target_ref_path is the reference we
193
193
point to, or None"""
@@ -370,7 +370,7 @@ def is_valid(self):
370
370
else :
371
371
return True
372
372
373
- @ property
373
+ @property
374
374
def is_detached (self ):
375
375
"""
376
376
:return:
@@ -420,7 +420,7 @@ def log_entry(self, index):
420
420
In that case, it will be faster than the ``log()`` method"""
421
421
return RefLog .entry_at (RefLog .path (self ), index )
422
422
423
- @ classmethod
423
+ @classmethod
424
424
def to_full_path (cls , path ) -> PathLike :
425
425
"""
426
426
:return: string with a full repository-relative path which can be used to initialize
@@ -434,7 +434,7 @@ def to_full_path(cls, path) -> PathLike:
434
434
full_ref_path = '%s/%s' % (cls ._common_path_default , path )
435
435
return full_ref_path
436
436
437
- @ classmethod
437
+ @classmethod
438
438
def delete (cls , repo , path ):
439
439
"""Delete the reference at the given path
440
440
@@ -492,7 +492,7 @@ def delete(cls, repo, path):
492
492
os .remove (reflog_path )
493
493
# END remove reflog
494
494
495
- @ classmethod
495
+ @classmethod
496
496
def _create (cls , repo , path , resolve , reference , force , logmsg = None ):
497
497
"""internal method used to create a new symbolic reference.
498
498
If resolve is False, the reference will be taken as is, creating
0 commit comments