bisect-kit: skip if manifest file syntax error
BUG=b:134120476
TEST=./setup_cros_bisect.py sync --chromeos
Change-Id: I078a5b5ccbc0c4c82ec218a5a45d307a38bfb83b
Reviewed-on: https://chromium-review.googlesource.com/1806216
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@google.com>
diff --git a/bisect_kit/git_util.py b/bisect_kit/git_util.py
index d40f69a..a2868d2 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -547,7 +547,8 @@
This function is file type neutral. `parser_callback(filename, content)` will
be invoked to parse file content and should return list of filename of
- dependencies.
+ dependencies. If `parser_callback` returns None (usually syntax error), the
+ commit is omitted.
Args:
git_repo: path of git repo
@@ -566,7 +567,10 @@
includes = {}
for commit_time, git_rev in history:
content = get_file_from_revision(git_repo, git_rev, path)
- for include_name in parser_callback(path, content):
+ parse_result = parser_callback(path, content)
+ if parse_result is None:
+ continue
+ for include_name in parse_result:
if include_name not in includes:
includes[include_name] = set()
includes[include_name].add(git_rev)