FIX: branchExists function and minor improvements
This commit is contained in:
parent
c0079e7adb
commit
c9d77ca119
|
@ -17,6 +17,7 @@ _log = logging.getLogger(__name__)
|
|||
def main() -> int:
|
||||
args = doSetup(sys.argv[1:])
|
||||
|
||||
_log.debug("Running main program")
|
||||
match args.command:
|
||||
case Subparser.Import:
|
||||
_log.debug("Start import handler")
|
||||
|
@ -85,7 +86,7 @@ def verifyRepository() -> None:
|
|||
mainBranch = api.settings.getValue(api.settings.General.mainBranch)
|
||||
if not api.repository.repo.branchExists(mainBranch):
|
||||
# TODO: create main branch
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError("Create main branch")
|
||||
|
||||
# Check if initialCommit exists
|
||||
commit = api.settings.getValue(api.settings.General.initialCommit)
|
||||
|
@ -106,7 +107,7 @@ if __name__ == "__main__":
|
|||
_log.exception("Mia terminated with a general error")
|
||||
|
||||
case customTypes.Exit.errConfig:
|
||||
_log.warn(
|
||||
_log.warning(
|
||||
"There is an issue with your config. Running mia is not possible."
|
||||
)
|
||||
|
||||
|
|
|
@ -45,17 +45,17 @@ class Repository:
|
|||
def __init__(self, repoPath: Path) -> None:
|
||||
if not repoPath.is_dir():
|
||||
# TODO: create dir if not existing
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError("Create repo dir")
|
||||
|
||||
try:
|
||||
self._repo = Repo(repoPath)
|
||||
except git.InvalidGitRepositoryError:
|
||||
# TODO: init repo
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError("Init git repo")
|
||||
|
||||
if not repoPath / ".git/annex":
|
||||
# TODO: git-annex init
|
||||
raise NotImplementedError()
|
||||
raise NotImplementedError("Annex verify")
|
||||
|
||||
def branchExists(self, branch: str) -> bool:
|
||||
"""Verifies the existence of a branch.
|
||||
|
@ -66,7 +66,7 @@ class Repository:
|
|||
Returns:
|
||||
True iff branch `branch` exists.
|
||||
"""
|
||||
return branch in [b for b in self._repo.branches]
|
||||
return branch in [b.name for b in self._repo.branches]
|
||||
|
||||
def treeIshExists(self, treeIsh: str) -> bool:
|
||||
"""Verifies the existence of a treeish.
|
||||
|
|
Loading…
Reference in New Issue