fix github clone to folder gitclone
This commit is contained in:
parent
8fc65ddae8
commit
1f1c183884
1
gitclone/enterprise
Submodule
1
gitclone/enterprise
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 38276c9a237a1779ce7a3e6f31102ff615691690
|
||||||
1
gitclone/odoo
Submodule
1
gitclone/odoo
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8678e1c777b1faec23d4e7fd311c8ec96041f5b7
|
||||||
@ -133,8 +133,11 @@ class DatasetProcessor:
|
|||||||
Returns:
|
Returns:
|
||||||
List of code samples with metadata
|
List of code samples with metadata
|
||||||
"""
|
"""
|
||||||
temp_dir = tempfile.mkdtemp()
|
# Create a persistent directory for cloned repositories
|
||||||
self.temp_dirs.append(temp_dir)
|
gitclone_dir = Path("./gitclone")
|
||||||
|
gitclone_dir.mkdir(exist_ok=True)
|
||||||
|
temp_dir = str(gitclone_dir)
|
||||||
|
# Note: We don't add this to temp_dirs since we want to keep it
|
||||||
|
|
||||||
depth = 1
|
depth = 1
|
||||||
branch = "18.0"
|
branch = "18.0"
|
||||||
@ -143,7 +146,7 @@ class DatasetProcessor:
|
|||||||
# Clone repository
|
# Clone repository
|
||||||
repo_name = repo_url.split('/')[-1].replace('.git', '')
|
repo_name = repo_url.split('/')[-1].replace('.git', '')
|
||||||
repo_path = os.path.join(temp_dir, repo_name)
|
repo_path = os.path.join(temp_dir, repo_name)
|
||||||
|
if not os.path.exists(repo_path):
|
||||||
self.logger.info(f"Cloning {repo_url} to {repo_path}")
|
self.logger.info(f"Cloning {repo_url} to {repo_path}")
|
||||||
|
|
||||||
# Use token for private repositories if provided
|
# Use token for private repositories if provided
|
||||||
@ -175,7 +178,8 @@ class DatasetProcessor:
|
|||||||
return code_samples
|
return code_samples
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Cleanup
|
# Cleanup temporary directories, but keep gitclone folder
|
||||||
|
if temp_dir != "./gitclone":
|
||||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||||
|
|
||||||
def _extract_code_samples(self, repo_path: str, config: AppConfig) -> List[Dict]:
|
def _extract_code_samples(self, repo_path: str, config: AppConfig) -> List[Dict]:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user