MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / get_current_branch

Function get_current_branch

autoagent/tools/github_ops.py:9–19  ·  view source on GitHub ↗

f""" Get the current branch of the 'autoagent'.

(context_variables)

Source from the content-addressed store, hash-verified

7from typing import Union
8@register_tool("get_current_branch")
9def get_current_branch(context_variables):
10 f"""
11 Get the current branch of the 'autoagent'.
12 """
13 env: Union[DockerEnv, LocalEnv] = context_variables.get("code_env", LocalEnv())
14 branch_command = f"cd {env.docker_workplace}/autoagent && git branch --show-current"
15 result = env.run_command(branch_command)
16 if result['status'] == 0:
17 return result['result'].strip()
18 else:
19 return f"Failed to get the current branch. Error: {result['result'].strip()}"
20
21@register_tool("get_diff")
22def get_diff(context_variables):

Callers 2

submit_pull_requestFunction · 0.85
github_ops.pyFile · 0.85

Calls 3

LocalEnvClass · 0.90
getMethod · 0.80
run_commandMethod · 0.45

Tested by

no test coverage detected