MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / _commit

Method _commit

codeclash/agents/player.py:196–210  ·  view source on GitHub ↗

Commit changes to the agent's codebase.

(self)

Source from the content-addressed store, hash-verified

194
195 commands = ["git status", "git apply tmp_patch.txt", "rm -f tmp_patch.txt"]
196 cmd = " && ".join(commands)
197 self.logger.debug(f"Executing command: {cmd}")
198 assert_zero_exit_code(self.environment.execute(cmd), logger=self.logger)
199
200 # --- Helper methods ---
201
202 def _round_message(self, round: int) -> str:
203 """Commit/tag message for a round. The tournament sets ``commit_label`` on the player config —
204 a prefix that carries its own separator (the ladder sets ``"Rung 2/50 (opponent, elo #49) — "``;
205 PvP sets ``""``). Pure concatenation, no per-mode branching here."""
206 return f"{self.config['commit_label']}Round {round} Update"
207
208 def _tag_round(self, round: int) -> None:
209 """Git tag the codebase at the given round."""
210 tag = self._get_round_tag_name(round)
211 assert_zero_exit_code(
212 self.environment.execute(f"git tag -a {tag} -m '{self._round_message(round)}'"),
213 logger=self.logger,

Callers 1

post_run_hookMethod · 0.95

Calls 3

_tag_roundMethod · 0.95
assert_zero_exit_codeFunction · 0.90
executeMethod · 0.45

Tested by

no test coverage detected