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/git_util.py b/bisect_kit/git_util.py
index e4b4e78..0c393b2 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -188,18 +188,20 @@
timestamp: timestamp
args: only the selected subset of history to query. If branch name is
specified, only parent of the said branch is queried. If omitted, only
- queries the parent of current working directory.
+ queries the parent of HEAD.
Returns:
git commit hash
"""
+ if not args:
+ args = ['HEAD']
return util.check_output(
'git',
- 'log',
+ 'rev-list',
+ '--first-parent',
'-1',
'--before',
str(timestamp),
- '--format=%H',
*args,
cwd=git_repo).strip()
@@ -215,7 +217,7 @@
Yields:
commit timestamp, git hash
"""
- cmd = ['git', 'log', '--reverse', '--format=%ct %H']
+ cmd = ['git', 'log', '--reverse', '--first-parent', '--format=%ct %H']
if after:
cmd += ['--after', str(after)]
cmd.append(path)