bisect-kit: add switch script builds by cq builder
TEST=./switch_cros_localbuild_internal.py --bucket bisect --nodeploy --build_revlist R81-12747.0.0-25156~R81-12747.0.0-25157/1
TEST=./switch_cros_localbuild_internal.py --board coral --buildbucket_id 8894318060265125680
TEST=./switch_cros_localbuild_internal.py --build_revlist R81-12747.0.0-25156~R81-12747.0.0-25157/1
BUG=b:140721312
Change-Id: Iebac7bf293db5379000dcdde08c3ce778ea8859c
diff --git a/bisect_kit/codechange.py b/bisect_kit/codechange.py
index 0e5bc68..5ab0618 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -951,16 +951,17 @@
return action_group.summary(self.code_storage)
def switch(self, rev):
+ rev_old, action_groups = self.get_intra_and_diff(rev)
+ self.spec_manager.sync_disk_state(rev_old)
+ apply_actions(self.code_storage, action_groups, self.root_dir)
+
+ def get_intra_and_diff(self, rev):
# easy case
if not re.match(_re_intra_rev, rev):
- self.spec_manager.sync_disk_state(rev)
- return
+ return rev, []
rev_old, rev_new, idx = parse_intra_rev(rev)
action_groups = self.load_action_groups_between_releases(rev_old, rev_new)
assert 0 <= idx <= len(action_groups)
action_groups = action_groups[:idx]
-
- self.spec_manager.sync_disk_state(rev_old)
-
- apply_actions(self.code_storage, action_groups, self.root_dir)
+ return rev_old, action_groups