Skip to content

Commit 7f49299

Browse files
committed
update
1 parent 99779c9 commit 7f49299

File tree

3 files changed

+16
-250
lines changed

3 files changed

+16
-250
lines changed

agent/run_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ def run_agent_for_repo(
8787

8888
# in cases where the latest commit of branch is not commit 0
8989
# set it back to commit 0
90-
latest_commit = str(local_repo.commit(branch))
91-
if latest_commit != example["base_commit"] and override_previous_changes:
90+
latest_commit = local_repo.commit(branch)
91+
if latest_commit.hexsha != example["base_commit"] and override_previous_changes:
9292
local_repo.git.reset("--hard", example["base_commit"])
9393

9494
target_edit_files = get_target_edit_files(
9595
local_repo,
9696
example["src_dir"],
9797
example["test"]["test_dir"],
98-
latest_commit,
98+
str(latest_commit),
9999
example["reference_commit"],
100100
)
101101
# Call the commit0 get-tests command to retrieve test files

agent/run_agent_no_rich.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ def run_agent_for_repo(
6161
repo_path = os.path.join(repo_base_dir, repo_name)
6262
repo_path = os.path.abspath(repo_path)
6363

64-
# get target files to edit and test files to run
65-
target_edit_files = get_target_edit_files(
66-
repo_path, example["src_dir"], example["test"]["test_dir"]
67-
)
68-
# Call the commit0 get-tests command to retrieve test files
69-
test_files_str = get_tests(repo_name, verbose=0)
70-
test_files = sorted(list(set([i.split(":")[0] for i in test_files_str])))
71-
7264
try:
7365
local_repo = Repo(repo_path)
7466
except Exception:
@@ -95,6 +87,19 @@ def run_agent_for_repo(
9587
if latest_commit.hexsha != example["base_commit"] and override_previous_changes:
9688
local_repo.git.reset("--hard", example["base_commit"])
9789

90+
# get target files to edit and test files to run
91+
target_edit_files = get_target_edit_files(
92+
local_repo,
93+
example["src_dir"],
94+
example["test"]["test_dir"],
95+
str(latest_commit),
96+
str(example["reference_commit"]),
97+
)
98+
99+
# Call the commit0 get-tests command to retrieve test files
100+
test_files_str = get_tests(repo_name, verbose=0)
101+
test_files = sorted(list(set([i.split(":")[0] for i in test_files_str])))
102+
98103
# prepare the log dir
99104
experiment_log_dir = (
100105
Path(log_dir)

agent/run_agent_test.py

Lines changed: 0 additions & 239 deletions
This file was deleted.

0 commit comments

Comments
 (0)