|
|
@@ -14,8 +14,8 @@ class Git(codearchiver.core.Module): |
|
|
|
def matches(inputUrl): |
|
|
|
return inputUrl.url.endswith('.git') |
|
|
|
|
|
|
|
def __init__(self, inputUrl, extraBranches = {}): |
|
|
|
super().__init__(inputUrl) |
|
|
|
def __init__(self, *args, extraBranches = {}, **kwargs): |
|
|
|
super().__init__(*args, **kwargs) |
|
|
|
self._extraBranches = extraBranches |
|
|
|
|
|
|
|
def process(self): |
|
|
@@ -24,7 +24,9 @@ class Git(codearchiver.core.Module): |
|
|
|
logger.fatal(f'{directory!r} already exists') |
|
|
|
return |
|
|
|
startTime = datetime.datetime.utcnow() |
|
|
|
bundle = f'{self._url.replace("/", "_")}.{startTime:%Y%m%dT%H%M%SZ}.bundle' |
|
|
|
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 |
|
|
@@ -49,7 +51,7 @@ class Git(codearchiver.core.Module): |
|
|
|
logger.info(f'Removing clone') |
|
|
|
shutil.rmtree(directory) |
|
|
|
|
|
|
|
return codearchiver.core.Result(id = f'git-{bundle[:-7]}', files = [bundle]) |
|
|
|
return codearchiver.core.Result(id = self._id, files = [bundle]) |
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
return f'{type(self).__module__}.{type(self).__name__}({self._inputUrl!r}, extraBranches = {self._extraBranches!r})' |