-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseProject_java
More file actions
57 lines (34 loc) · 1.23 KB
/
parseProject_java
File metadata and controls
57 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from pymongo import MongoClient
import sh
import time
def clone_repo(url, destination):
try:
# Run the git clone command
sh.git.clone(url, destination)
print("Repository cloned successfully.")
except Exception as e:
print("Error occurred while cloning repository: Repository not found or URL is incorrect.",e)
# client = MongoClient("localhost",27017)
client = MongoClient('mongodb+srv://mbillahmim:[email protected]/')
db = client.sample_mflix
Methods = db.repoMethods
# Destination directory where the repository will be cloned
destination_dir = "/student/mjr175/commentGeneration/JavaProjects/"
# Keep track of already cloned repositories
cloned_repos = set()
cnt=0
# Iterate through documents and clone unique repositories
# for methods in helperMethods.find():
# repo = methods.get('repo')
# if repo not in cloned_repos:
# cloned_repos.add(repo)
# for repo in cloned_repos:
# repo_url = "https://github.com/" + repo
# # Construct the repository URL
# print(repo_url)
# clone_repo(repo_url, destination_dir+repo)
# time.sleep(10)
for methods in Methods.find():
#print(methods)
cnt+=1
print(cnt)