Browse Source

Raise exceptions on fatal errors

tags/v1.0
JustAnotherArchivist 1 year ago
parent
commit
6af07cb51c
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      codearchiver/modules/git.py

+ 2
- 2
codearchiver/modules/git.py View File

@@ -34,14 +34,14 @@ class Git(codearchiver.core.Module):
directory = self._url.rsplit('/', 1)[1]
if os.path.exists(directory):
logger.fatal(f'{directory!r} already exists')
return
raise FileExistsError(f'{directory!r} already exists')
startTime = datetime.datetime.utcnow()
if self._id is None:
self._id = f'git_{self._url.replace("/", "_")}_{startTime:%Y%m%dT%H%M%SZ}'
bundle = f'{self._id}.bundle'
if os.path.exists(bundle):
logger.fatal(f'{bundle!r} already exists')
return
raise FileExistsError(f'{bundle!r} already exists')

logger.info(f'Cloning {self._url} into {directory}')
codearchiver.subprocess.run_with_log(['git', 'clone', '--verbose', '--mirror', self._url, directory])


Loading…
Cancel
Save