bisect-kit: fix add/remove repo coding mistake
When more than one add/remove actions in one action group, the original
code incorrectly applys only the last action.
BUG=b:176320467
TEST=./switch_cros_cr_localbuild_internal.py '89.0.4357.0~89.0.4358.0/437'
Change-Id: If53480cff3deaed8f131d413a4b6fd769c8395a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/bisect-kit/+/2603758
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Auto-Submit: Kuang-che Wu <kcwu@chromium.org>
Commit-Queue: Zheng-Jie Chang <zjchang@chromium.org>
Reviewed-by: Zheng-Jie Chang <zjchang@chromium.org>
diff --git a/bisect_kit/codechange.py b/bisect_kit/codechange.py
index 2c97423..0ec6248 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -418,7 +418,7 @@
def apply(self, code_storage, root_dir):
assert self.path
git_repo = os.path.join(root_dir, self.path)
- assert git_util.is_git_root(git_repo)
+ assert git_util.is_git_root(git_repo), '%r should be a git repo' % git_repo
# TODO(kcwu): other projects may be sub-tree of `git_repo`.
# They should not be deleted. (crbug/930047)
shutil.rmtree(git_repo)
@@ -457,7 +457,8 @@
batch_apply(commits)
commits = {}
- action.apply(code_storage, root_dir)
+ logger.debug('[%d] applying "%r"', i, action_group.summary())
+ action_group.apply(code_storage, root_dir)
batch_apply(commits)