|
36 | 36 | __all__= ["SymbolicReference"]
|
37 | 37 |
|
38 | 38 |
|
39 |
| -def_git_dir(repo:'Repo',path:Union[PathLike,None])->PathLike: |
| 39 | +def_git_dir(repo:'Repo',path:PathLike)->PathLike: |
40 | 40 | """ Find the git dir that's appropriate for the path"""
|
41 | 41 | name=f"{path}"
|
42 | 42 | ifnamein ['HEAD','ORIG_HEAD','FETCH_HEAD','index','logs']:
|
@@ -136,27 +136,26 @@ def _iter_packed_refs(cls, repo: 'Repo') -> Iterator[Tuple[str, str]]:
|
136 | 136 | # alright.
|
137 | 137 |
|
138 | 138 | @classmethod
|
139 |
| -defdereference_recursive(cls,repo:'Repo',ref_path:Union[None,PathLike])->str: |
| 139 | +defdereference_recursive(cls,repo:'Repo',ref_path:PathLike)->str: |
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 |
| -whileTrue:# loop that overwrites ref_path each loop |
| 144 | +whileTrue: |
145 | 145 | hexsha,ref_path=cls._get_ref_info(repo,ref_path)
|
146 | 146 | ifhexshaisnotNone:
|
147 | 147 | returnhexsha
|
148 | 148 | # END recursive dereferencing
|
149 | 149 |
|
150 | 150 | @classmethod
|
151 |
| -def_get_ref_info_helper(cls,repo:'Repo',ref_path:Union[PathLike,None] |
152 |
| - )->Union[Tuple[str,None],Tuple[None,str]]: |
| 151 | +def_get_ref_info_helper(cls,repo:'Repo',ref_path:PathLike): |
153 | 152 | """Return: (str(sha), str(target_ref_path)) if available, the sha the file at
|
154 | 153 | rela_path points to, or None. target_ref_path is the reference we
|
155 | 154 | point to, or None"""
|
156 | 155 | tokens:Union[None,List[str],Tuple[str,str]]=None
|
157 | 156 | repodir=_git_dir(repo,ref_path)
|
158 | 157 | try:
|
159 |
| -withopen(os.path.join(repodir,cast(str,ref_path)),'rt',encoding='UTF-8')asfp: |
| 158 | +withopen(os.path.join(repodir,ref_path),'rt',encoding='UTF-8')asfp: |
160 | 159 | value=fp.read().rstrip()
|
161 | 160 | # Don't only split on spaces, but on whitespace, which allows to parse lines like
|
162 | 161 | # 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo
|
@@ -188,7 +187,7 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: Union[PathLike, None]
|
188 | 187 | raiseValueError("Failed to parse reference information from %r"%ref_path)
|
189 | 188 |
|
190 | 189 | @classmethod
|
191 |
| -def_get_ref_info(cls,repo:'Repo',ref_path:Union[PathLike,None])->Union[Tuple[str,None],Tuple[None,str]]: |
| 190 | +def_get_ref_info(cls,repo,ref_path): |
192 | 191 | """Return: (str(sha), str(target_ref_path)) if available, the sha the file at
|
193 | 192 | rela_path points to, or None. target_ref_path is the reference we
|
194 | 193 | point to, or None"""
|
|