Skip to content

Commit 7a97518

Browse files
[CI] Make clone_repository_if_not_present public
So that it can be used in the advisor on server startup to avoid the first request taking a long time.
1 parent d3fb8b8 commit 7a97518

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

premerge/advisor/git_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
FIRST_COMMIT_SHA = "f8f7f1b67c8ee5d81847955dc36fab86a6d129ad"
88

99

10-
def _clone_repository_if_not_present(
10+
def clone_repository_if_not_present(
1111
repository_path: str, repository_url=REPOSITORY_URL
1212
):
1313
if not os.path.exists(os.path.join(repository_path, ".git")):
@@ -71,7 +71,7 @@ def get_commit_index(
7171
db_connection: sqlite3.Connection,
7272
first_commit_sha=FIRST_COMMIT_SHA,
7373
) -> int | None:
74-
_clone_repository_if_not_present(repository_path)
74+
clone_repository_if_not_present(repository_path)
7575
# Check to see if we already have the commit in the DB.
7676
commit_matches = db_connection.execute(
7777
"SELECT commit_index FROM commits WHERE commit_sha=?", (commit_sha,)

premerge/advisor/git_utils_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_clone_repository(self):
5858
self.setup_repository(5)
5959
utils_repo_folder = tempfile.TemporaryDirectory()
6060
utils_repo_path = os.path.join(utils_repo_folder.name, "repo")
61-
git_utils._clone_repository_if_not_present(
61+
git_utils.clone_repository_if_not_present(
6262
utils_repo_path, self.repository_path.name
6363
)
6464
log_process = subprocess.run(

premerge/advisor/integration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def setUp(self):
1111
self.db_file = tempfile.NamedTemporaryFile()
1212
self.repository_path_dir = tempfile.TemporaryDirectory()
1313
self.repository_path = os.path.join(self.repository_path_dir.name, "actions")
14-
git_utils._clone_repository_if_not_present(
14+
git_utils.clone_repository_if_not_present(
1515
self.repository_path, "https://github.com/llvm/actions"
1616
)
1717
self.app = advisor.create_app(self.db_file.name, self.repository_path)

0 commit comments

Comments
 (0)