|
5 | 5 | from pathlib import Path |
6 | 6 | from typing import Union, Any |
7 | 7 |
|
| 8 | +import sh |
8 | 9 | from rich.style import Style |
9 | 10 | from rich.text import Text |
10 | | -from sh import git, ErrorReturnCode |
11 | 11 |
|
12 | 12 | from codelimit.common.Configuration import Configuration |
13 | | -from codelimit.common.Measurement import Measurement |
14 | 13 | from codelimit.common.GithubRepository import GithubRepository |
| 14 | +from codelimit.common.Measurement import Measurement |
15 | 15 | from codelimit.common.gsm.Expression import Expression |
16 | 16 | from codelimit.common.gsm.operator.Operator import Operator |
17 | 17 | from codelimit.common.token_matching.predicate.TokenValue import TokenValue |
@@ -207,17 +207,17 @@ def replace_string_literal_with_predicate(expression: Expression) -> Expression: |
207 | 207 |
|
208 | 208 | def _get_git_branch(path: Path) -> str | None: |
209 | 209 | try: |
210 | | - out = git('rev-parse', '--abbrev-ref', 'HEAD', _cwd=path) |
| 210 | + out = sh.git('rev-parse', '--abbrev-ref', 'HEAD', _cwd=path) |
211 | 211 | return out.strip() |
212 | | - except ErrorReturnCode: |
| 212 | + except sh.ErrorReturnCode | sh.CommandNotFound: |
213 | 213 | return None |
214 | 214 |
|
215 | 215 |
|
216 | 216 | def _get_remote_url(path: Path) -> str | None: |
217 | 217 | try: |
218 | | - out = git('config', '--get', 'remote.origin.url', _cwd=path) |
| 218 | + out = sh.git('config', '--get', 'remote.origin.url', _cwd=path) |
219 | 219 | return out.strip() |
220 | | - except ErrorReturnCode: |
| 220 | + except sh.ErrorReturnCode | sh.CommandNotFound: |
221 | 221 | return None |
222 | 222 |
|
223 | 223 |
|
|
0 commit comments