bisect-kit: fix repo sync failure due to manifest group change
If a project was moved from default group to non-default group in a
manifest file, we thought the project was removed and need to add it to
our local manifest file in order to fetch its history. However, the said
project is still existing and 'repo sync' abort because of duplication.
In this CL, we detect such case and skip this kind of projects. We may
miss some history to mirror but should be acceptable for such corner
case.
BUG=b:149799623
TEST=./setup_cros_bisect.py sync --chromeos
Change-Id: I911b58b1ffc58fb5da2e9236909c7008954e3447
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/bisect-kit/+/2596622
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Auto-Submit: Kuang-che Wu <kcwu@chromium.org>
Commit-Queue: Chi-Ngai Wan <cnwan@google.com>
Reviewed-by: Chi-Ngai Wan <cnwan@google.com>
diff --git a/bisect_kit/repo_util.py b/bisect_kit/repo_util.py
index cac7175..0c6d9ca 100644
--- a/bisect_kit/repo_util.py
+++ b/bisect_kit/repo_util.py
@@ -386,7 +386,9 @@
self.element_equal(node1, node2)
for node1, node2 in zip(element1, element2))
- def process_parsed_result(self, root):
+ def process_parsed_result(self, root, group_constraint='default'):
+ if group_constraint not in ('default', 'all'):
+ raise ValueError('only "default" and "all" are supported')
result = {}
default = root.find('default')
if default is None:
@@ -406,8 +408,9 @@
assert root.find('include') is None
for project in root.findall('.//project'):
- if 'notdefault' in project.get('groups', ''):
- continue
+ if group_constraint == 'default':
+ if 'notdefault' in project.get('groups', ''):
+ continue
for subproject in project.findall('.//project'):
logger.warning('nested project %s.%s is not supported and ignored',
project.get('name'), subproject.get('name'))