Update core/git_manager.py
Browse files- core/git_manager.py +3 -5
core/git_manager.py
CHANGED
@@ -5,14 +5,13 @@ class GitManager:
|
|
5 |
def __init__(self, repo_url: str, target_dir: Path):
|
6 |
self.repo_url = repo_url
|
7 |
self.target_dir = target_dir
|
8 |
-
|
9 |
def clone_repository(self) -> bool:
|
10 |
try:
|
11 |
if self.target_dir.exists():
|
12 |
raise FileExistsError(f"Directory already exists: {self.target_dir}")
|
13 |
|
14 |
self.target_dir.parent.mkdir(parents=True, exist_ok=True)
|
15 |
-
|
16 |
subprocess.run(
|
17 |
["git", "clone", self.repo_url, str(self.target_dir)],
|
18 |
check=True,
|
@@ -20,10 +19,9 @@ class GitManager:
|
|
20 |
text=True
|
21 |
)
|
22 |
return True
|
23 |
-
|
24 |
except subprocess.CalledProcessError as e:
|
25 |
raise RuntimeError(f"Clone error: {e.stderr}")
|
26 |
-
|
27 |
def cleanup(self):
|
28 |
if self.target_dir.exists():
|
29 |
subprocess.run(
|
@@ -31,4 +29,4 @@ class GitManager:
|
|
31 |
check=True,
|
32 |
capture_output=True,
|
33 |
text=True
|
34 |
-
)
|
|
|
5 |
def __init__(self, repo_url: str, target_dir: Path):
|
6 |
self.repo_url = repo_url
|
7 |
self.target_dir = target_dir
|
8 |
+
|
9 |
def clone_repository(self) -> bool:
|
10 |
try:
|
11 |
if self.target_dir.exists():
|
12 |
raise FileExistsError(f"Directory already exists: {self.target_dir}")
|
13 |
|
14 |
self.target_dir.parent.mkdir(parents=True, exist_ok=True)
|
|
|
15 |
subprocess.run(
|
16 |
["git", "clone", self.repo_url, str(self.target_dir)],
|
17 |
check=True,
|
|
|
19 |
text=True
|
20 |
)
|
21 |
return True
|
|
|
22 |
except subprocess.CalledProcessError as e:
|
23 |
raise RuntimeError(f"Clone error: {e.stderr}")
|
24 |
+
|
25 |
def cleanup(self):
|
26 |
if self.target_dir.exists():
|
27 |
subprocess.run(
|
|
|
29 |
check=True,
|
30 |
capture_output=True,
|
31 |
text=True
|
32 |
+
)
|