crossover between commit1 and commit2
(config: EvoGitConfig, seed: int, commit1: str, commit2: str)
| 219 | |
| 220 | |
| 221 | def git_crossover(config: EvoGitConfig, seed: int, commit1: str, commit2: str) -> str: |
| 222 | """crossover between commit1 and commit2""" |
| 223 | random.seed(seed) |
| 224 | use_merge = random.choices( |
| 225 | [True, False], weights=[config.merge_prob, 1 - config.merge_prob] |
| 226 | )[0] |
| 227 | if use_merge: |
| 228 | git_merge(config, commit1, commit2) |
| 229 | else: |
| 230 | git_rebase(config, commit1, commit2) |
| 231 | |
| 232 | return git.read_head_commit(config) |
| 233 | |
| 234 | |
| 235 | def git_merge(config: EvoGitConfig, commit1: str, commit2: str) -> None: |
nothing calls this directly
no test coverage detected