diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-31 16:23:11 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-31 16:23:11 +0100 |
commit | ad4517ff7c6bb629097a1adae204c27a7af4ba4b (patch) | |
tree | 04bea575bf4a978cf2b8456cc2ec7116b003ecd4 /git/refs/symbolic.py | |
parent | 1f922671be65261538314f8759e473084c5ed865 (diff) | |
download | gitpython-ad4517ff7c6bb629097a1adae204c27a7af4ba4b.tar.gz |
Add type to symbolicreference._get_packed_refs_path()
Diffstat (limited to 'git/refs/symbolic.py')
-rw-r--r-- | git/refs/symbolic.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 4b04add5..74bc0a39 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -136,23 +136,23 @@ class SymbolicReference(object): # alright. @classmethod - def dereference_recursive(cls, repo: 'Repo', ref_path: PathLike) -> str: + def dereference_recursive(cls, repo, ref_path): """ :return: hexsha stored in the reference at the given ref_path, recursively dereferencing all intermediate references as required :param repo: the repository containing the reference at ref_path""" while True: - hexsha, _ref_path = cls._get_ref_info(repo, ref_path) + hexsha, ref_path = cls._get_ref_info(repo, ref_path) if hexsha is not None: return hexsha # END recursive dereferencing @classmethod - def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]: + def _get_ref_info_helper(cls, repo, ref_path): """Return: (str(sha), str(target_ref_path)) if available, the sha the file at rela_path points to, or None. target_ref_path is the reference we point to, or None""" - tokens: Union[Tuple[str, str], List[str], None] = None + tokens = None repodir = _git_dir(repo, ref_path) try: with open(os.path.join(repodir, ref_path), 'rt', encoding='UTF-8') as fp: @@ -169,7 +169,7 @@ class SymbolicReference(object): if path != ref_path: continue # sha will be used - tokens = (sha, path) + tokens = sha, path break # END for each packed ref # END handle packed refs @@ -186,8 +186,8 @@ class SymbolicReference(object): raise ValueError("Failed to parse reference information from %r" % ref_path) - @ classmethod - def _get_ref_info(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]: + @classmethod + def _get_ref_info(cls, repo, ref_path): """Return: (str(sha), str(target_ref_path)) if available, the sha the file at rela_path points to, or None. target_ref_path is the reference we point to, or None""" @@ -370,7 +370,7 @@ class SymbolicReference(object): else: return True - @ property + @property def is_detached(self): """ :return: @@ -420,7 +420,7 @@ class SymbolicReference(object): In that case, it will be faster than the ``log()`` method""" return RefLog.entry_at(RefLog.path(self), index) - @ classmethod + @classmethod def to_full_path(cls, path) -> PathLike: """ :return: string with a full repository-relative path which can be used to initialize @@ -434,7 +434,7 @@ class SymbolicReference(object): full_ref_path = '%s/%s' % (cls._common_path_default, path) return full_ref_path - @ classmethod + @classmethod def delete(cls, repo, path): """Delete the reference at the given path @@ -492,7 +492,7 @@ class SymbolicReference(object): os.remove(reflog_path) # END remove reflog - @ classmethod + @classmethod def _create(cls, repo, path, resolve, reference, force, logmsg=None): """internal method used to create a new symbolic reference. If resolve is False, the reference will be taken as is, creating |