bisect-kit: migrate android bisector to use codechange module
After this CL, android localbuild bisector can handle following issues:
- add and remove repo projects
- git history incomplete due to <project clone-depth="1">
- manifest snapshot racing
The setup step of android checkout is changed as well. Now you have to
make a repo mirror and sync the tree from the mirror. The exact steps
are:
1. cd $ANDROID_REPO_MIRROR_DIR
repo init ...<original flags>... --mirror
repo sync -c
2. cd $ANDROID_ROOT
repo init ...<original flags>... --reference=$ANDROID_REPO_MIRROR_DIR
repo sync -c
3. specify --android_repo_mirror_dir $ANDROID_REPO_MIRROR_DIR when you
use bisect_android_repo.py and switch_arc_localbuild.py
BUG=None
TEST=unit test and following commands
$ ./bisect_android_repo.py init \
--old 4851505 --new 4852106 --dut $DUT \
--android_root $ANDROID_ROOT \
--android_repo_mirror_dir $ANDROID_REPO_MIRROR_DIR
$ ./bisect_android_repo.py view
$ ./switch_arc_localbuild.py \
--android_root $ANDROID_ROOT \
--android_repo_mirror_dir $ANDROID_REPO_MIRROR_DIR \
$DUT 4851505~4852106/1
Change-Id: I2708c119e328ec294a02a45bb3a7710ef1a603c5
Reviewed-on: https://chromium-review.googlesource.com/1126182
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Reviewed-by: Chi-Ngai Wan <cnwan@google.com>
diff --git a/bisect_kit/codechange.py b/bisect_kit/codechange.py
index b57956b..abc8e83 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -387,12 +387,12 @@
commit_action.apply(root_dir)
for i, action_group in enumerate(action_groups, 1):
- for action in action_group:
+ for action in action_group.actions:
if not isinstance(action, GitCheckoutCommit):
break
else:
# If all actions are commits, defer them for batch processing.
- for action in action_group:
+ for action in action_group.actions:
commits[action.path] = (i, action)
continue
@@ -778,7 +778,10 @@
next_float = specs[i + 1]
logger.debug('[%d], between %s (%s) and %s (%s)', i, prev_float.name,
prev_float.timestamp, next_float.name, next_float.timestamp)
- actions += self.generate_actions_between_specs(prev_float, next_float)
+ for action in self.generate_actions_between_specs(prev_float, next_float):
+ if action.timestamp < fixed_specs[0].timestamp:
+ continue
+ actions.append(action)
action_groups = self.reorder_actions(actions)
spec = self.synthesize_fixed_spec(float_specs[0], fixed_specs[0].timestamp)