summaryrefslogtreecommitdiff
path: root/worker/GiteaWorker.py
diff options
context:
space:
mode:
Diffstat (limited to 'worker/GiteaWorker.py')
-rw-r--r--worker/GiteaWorker.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/worker/GiteaWorker.py b/worker/GiteaWorker.py
index d7677c8..bb7ac0b 100644
--- a/worker/GiteaWorker.py
+++ b/worker/GiteaWorker.py
@@ -1,4 +1,3 @@
-from logging import FATAL
from shutil import ignore_patterns, copytree, rmtree
from util import Logger
import multiprocessing
@@ -55,10 +54,10 @@ class GiteaWorker():
repo.git.checkout(f"{stuID}", "-f")
repo.git.pull("origin", f"{stuID}", "--rebase", "-f")
repo.git.reset(f"origin/{stuID}", "--hard")
- # copytree(os.path.join( 'hwrepos', repoName),
- # os.path.join( 'indv',
- # f"{repoName} {stuID} {stuName}"),
- # ignore=ignore_patterns('.git'))
+ if self.args.dir:
+ copytree(os.path.join('hwrepos', repoName),
+ os.path.join('indv', f"{repoName} {stuID} {stuName}"),
+ ignore=ignore_patterns('.git'))
if not os.path.exists(
os.path.join('hwrepos', repoName, f"h{hwNum}")):
self.logger.warning(
@@ -173,8 +172,9 @@ class GiteaWorker():
self.logger.debug(f"{repoName} pull succeed")
def checkIndv(self):
- # if os.path.exists(os.path.join( 'indv')):
- # rmtree(os.path.join( 'indv'))
+ if self.args.dir:
+ if os.path.exists(os.path.join('indv')):
+ rmtree(os.path.join('indv'))
hwNum, tidy = self.args.hw, self.args.tidy
with multiprocessing.Pool(self.processCount) as p:
res = p.starmap(self.checkIndvProcess,