Skip to content

Commit 6f5be5c

Browse files
Fix type errors by implementing missing methods in LocalGitRepo
Added the following methods to LocalGitRepo class: - add_remote: Adds a new remote to the repository - fetch_remote: Fetches from a remote - checkout_branch: Checks out a branch, creating it if it doesn't exist These methods were being called in agent_detail.py but were not implemented in the class. Co-authored-by: Jay Hack <jay@codegen.com>
1 parent bd066d2 commit 6f5be5c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/codegen/git/repo_operator/local_git_repo.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,30 @@ def get_language(self, access_token: str | None = None) -> str:
8282

8383
def has_remote(self) -> bool:
8484
return bool(self.git_cli.remotes)
85+
86+
def add_remote(self, name: str, url: str) -> None:
87+
"""Add a new remote to the repository.
88+
89+
Args:
90+
name: The name of the remote
91+
url: The URL of the remote
92+
"""
93+
self.git_cli.create_remote(name, url)
94+
95+
def fetch_remote(self, remote_name: str) -> None:
96+
"""Fetch from a remote.
97+
98+
Args:
99+
remote_name: The name of the remote to fetch from
100+
"""
101+
remote = self.git_cli.remote(remote_name)
102+
remote.fetch()
103+
104+
def checkout_branch(self, ref: str, branch_name: str) -> None:
105+
"""Checkout a branch, creating it if it doesn't exist.
106+
107+
Args:
108+
ref: The reference to checkout from (e.g., 'origin/main')
109+
branch_name: The name of the branch to create or checkout
110+
"""
111+
self.git_cli.git.checkout(ref, b=branch_name)

0 commit comments

Comments
 (0)