Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/scmrepo/git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import TYPE_CHECKING, Callable, Dict, Iterable, Optional, Tuple, Type, Union

from funcy import cached_property, first
from git import GitCommandNotFound
from pathspec.patterns import GitWildMatchPattern

from scmrepo.base import Base
Expand All @@ -33,6 +34,8 @@

_LOW_PRIO_BACKENDS = ("gitpython",)

_SKIPPABLE = (NotImplementedError, GitCommandNotFound)


class GitBackends(Mapping):
DEFAULT: Dict[str, BackendCls] = {
Expand Down Expand Up @@ -100,7 +103,7 @@ def dir(self):
for backend in self.backends.values():
try:
return backend.dir
except NotImplementedError:
except _SKIPPABLE:
pass
raise NotImplementedError

Expand Down Expand Up @@ -141,7 +144,7 @@ def clone(
if rev:
repo.checkout(rev)
return repo
except NotImplementedError:
except _SKIPPABLE:
pass
raise NoGitBackendError("clone")

Expand Down Expand Up @@ -284,7 +287,7 @@ def _backend_func(self, name, *args, **kwargs):
self._last_backend = key
self.backends.move_to_end(key, last=False)
return result
except NotImplementedError:
except _SKIPPABLE:
pass
raise NoGitBackendError(name)

Expand All @@ -302,7 +305,7 @@ def init(cls, path: str, bare: bool = False, _backend: str = None) -> "Git":
backend.init(path, bare=bare)
# TODO: reuse created object instead of initializing a new one.
return cls(path)
except NotImplementedError:
except _SKIPPABLE:
pass
raise NoGitBackendError("init")

Expand Down