From 71532c2b40372a958f97b20ddd0aacc979e7eb6b Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 1 Mar 2024 13:23:08 -0500 Subject: [PATCH 1/5] cloning only target branch with depth 1 --- main.py | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index b9f056e..32c29b7 100644 --- a/main.py +++ b/main.py @@ -100,6 +100,36 @@ def is_git_directory(dir): git_dir_path = os.path.join(dir, '.git') return os.path.exists(git_dir_path) and os.path.isdir(git_dir_path) +def get_target_data(url, branch, commit, directory): + ''' + Get target repository data + + Parameters: + url (str): repository url + branch(str): branch name + commit(str): commit # + directory (str): directory to clone in + ''' + project_name = get_repository_name(url) + if (os.path.exists(os.path.join(directory, project_name))): + print(f"{project_name} repository already exists. Aborting cloning") + return + + clone_command = ["git", "clone"] + if branch: + clone_command.extend(["-b", branch]) + if not commit: + clone_command.extend(["--depth", "1"]) + clone_command.append(url) + subprocess.run(clone_command, cwd=directory) # targetted clone is fast, no need to reuse existing one. + else: + clone_command.append(url) + subprocess.run(clone_command, cwd=directory) + checkout_commit(commit, os.path.join(directory, get_repository_name(url))) + + cmd_str = ' '.join(clone_command) + print(f"get_target_data -> {cmd_str}") + def clone_repository(url, directory): ''' Clone a repository from 'url' in 'directory' @@ -299,15 +329,10 @@ def performEvaluation(issue_data) -> Result: issue_folder_abs_dir = os.path.abspath(issue_folder_dir) input_dir = create_issue_directory(issue_folder_abs_dir, issue_id) - clone_repository(url, input_dir) - repo_name = get_repository_name(url) - if branch: - change_branch(branch, os.path.join(input_dir, repo_name)) + get_target_data(url, branch, commit_hash, input_dir) - if commit_hash: - checkout_commit(commit_hash, os.path.join(input_dir, repo_name)) - + repo_name = get_repository_name(url) specimin_command = "" result: Result = None specimin_path = get_specimin_env_var() From d1f0e32920c4a0a5968b73cb502d240444c39fb3 Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 1 Mar 2024 13:33:21 -0500 Subject: [PATCH 2/5] add specimin repo --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 32c29b7..3db9ba0 100644 --- a/main.py +++ b/main.py @@ -201,7 +201,7 @@ def clone_specimin(path_to_clone, url): if (os.path.exists(spcimin_source_path)) and os.path.isdir(spcimin_source_path): perform_git_pull(spcimin_source_path) else: - clone_repository(url, path_to_clone) + get_target_data(url, "", "", path_to_clone) def build_specimin_command(project_name: str, From c7e43fb1c4d2629575b07bb930b41460dcbf9581 Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 1 Mar 2024 15:04:41 -0500 Subject: [PATCH 3/5] replacing remote url with forked url and instead of commit using branch name --- resources/test_data.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/test_data.json b/resources/test_data.json index 364de9e..9cdd136 100644 --- a/resources/test_data.json +++ b/resources/test_data.json @@ -1,8 +1,8 @@ [ { "issue_id" : "cf-1291", - "url": "https://github.com/codespecs/daikon.git", - "branch": "", + "url": "https://github.com/tahiat/daikon.git", + "branch": "cf-1291", "commit_hash": "15d7c2d84", "project_name": "daikon", "build_command": "this can be cf command or java", @@ -39,9 +39,9 @@ }, { "issue_id" : "cf-6077", - "url": "https://github.com/jacek-lewandowski/cassandra.git", - "branch": "checker-framework-testing", - "commit_hash": "7b3c4ce8e5d6da41791492903ec367b8857cd57d", + "url": "https://github.com/tahiat/cassandra.git", + "branch": "cf-6077", + "commit_hash": "", "project_name": "cassandra", "build_command": "ant cf-only -Dcf.check.only=org/apache/cassandra/index/sasi/conf/IndexMode.java", "root_dir": "src/java", From f942eccc8aeaad1845cbc35c54ebb3f6e58b4d01 Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 1 Mar 2024 15:08:57 -0500 Subject: [PATCH 4/5] remove commit_hash for daikon --- resources/test_data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/test_data.json b/resources/test_data.json index 9cdd136..21f5137 100644 --- a/resources/test_data.json +++ b/resources/test_data.json @@ -3,7 +3,7 @@ "issue_id" : "cf-1291", "url": "https://github.com/tahiat/daikon.git", "branch": "cf-1291", - "commit_hash": "15d7c2d84", + "commit_hash": "", "project_name": "daikon", "build_command": "this can be cf command or java", "root_dir": "java", From a07cddb6536e32bab7be0916fdf7bfa63694f197 Mon Sep 17 00:00:00 2001 From: Tahiatul Islam Date: Fri, 1 Mar 2024 15:24:28 -0500 Subject: [PATCH 5/5] change for beam project --- resources/test_data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/test_data.json b/resources/test_data.json index 21f5137..fbea10c 100644 --- a/resources/test_data.json +++ b/resources/test_data.json @@ -328,8 +328,8 @@ }, { "issue_id" : "cf-6388", - "url": "https://github.com/kennknowles/beam.git", - "branch": "checkerframework-StructuralEqualityComparer", + "url": "https://github.com/tahiat/beam.git", + "branch": "cf-6388", "commit_hash": "", "project_name": "beam", "build_command": "checkerframework-StructuralEqualityComparer",