| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -418,7 +418,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No | |||
| 418 | 418 | # END check url | |
| 419 | 419 | # END verify urls match | |
| 420 | 420 | ||
| 421 | - # mrepo: Union[Repo, None] = None | ||
| 421 | + mrepo: Union[Repo, None] = None | ||
| 422 | 422 | ||
| 423 | 423 | if url is None: | |
| 424 | 424 | if not has_module: | |
@@ -474,7 +474,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No | |||
| 474 | 474 | sm._branch_path = br.path | |
| 475 | 475 | ||
| 476 | 476 | # we deliberately assume that our head matches our index ! | |
| 477 | - sm.binsha = mrepo.head.commit.binsha | ||
| 477 | + if mrepo is not None: | ||
| 478 | + sm.binsha = mrepo.head.commit.binsha | ||
| 478 | 479 | index.add([sm], write=True) | |
| 479 | 480 | ||
| 480 | 481 | return sm | |
@@ -589,8 +590,8 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision: | |||
| 589 | 590 | if not dry_run: | |
| 590 | 591 | # see whether we have a valid branch to checkout | |
| 591 | 592 | try: | |
| 592 | - # assert isinstance(mrepo, Repo) # cant do this cos of circular import | ||
| 593 | - mrepo = cast('Repo', mrepo) # Try TypeGuard wirh hasattr? | ||
| 593 | + # assert isinstance(mrepo, Repo) # cant do this cos of circular import | ||
| 594 | + mrepo = cast('Repo', mrepo) # Try TypeGuard wirh hasattr, or has_remotes&_head protocol? | ||
| 594 | 595 | # find a remote which has our branch - we try to be flexible | |
| 595 | 596 | remote_branch = find_first_remote_branch(mrepo.remotes, self.branch_name) | |
| 596 | 597 | local_branch = mkhead(mrepo, self.branch_path) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,7 @@ class ConfigLevels_NT(NamedTuple): | |||
| 57 | 57 | ||
| 58 | 58 | def assert_never(inp: NoReturn, exc: Union[Exception, None] = None) -> NoReturn: | |
| 59 | 59 | if exc is None: | |
| 60 | - assert False, f"An unhandled Literal ({inp}) in an if else chain was found" | ||
| 60 | + assert False, f"An unhandled Literal ({inp}) in an if/else chain was found" | ||
| 61 | 61 | else: | |
| 62 | 62 | raise exc | |
| 63 | 63 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments