bisect-kit: fix chromeos manifest branch
The timeline of manifest change and releases:
1. manifest commit
2. release-R83-13020.B branched
3. R84-13021.0.0 release
4. R84-13022.0.0 release
Note that there are no manifest commits on master branch between 1 and
3. Thus, both 13021.0.0 and 13022.0.0 are based on the same manifest
file before R83 was branched. In other words, collect_float_spec() think
13022.0.0 is possible on both master and R83 branch, which is incorrect.
Even worse, the order of list(set(...)) is not stable. Thus, the result
of bisect_cros_repo.py init is nondeterministic --- sometimes correct
and sometimes incorrect (when release-R83-13020.B is the first).
BUG=None
TEST=./bisect_cros_repo.py init --old R84-13021.0.0 --new R84-13022.0.0
Change-Id: If496525b7184e7a17fc2bac96a68acb798572f4f
diff --git a/bisect_kit/git_util.py b/bisect_kit/git_util.py
index f3da4e4..63d156b 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -886,13 +886,14 @@
return result2
-def get_branches(git_repo, all_branches=True, commit=None):
+def get_branches(git_repo, all_branches=True, commit=None, remote=False):
"""Get branches of a repository.
Args:
git_repo: path of git repo
all_branches: return remote branches if is set to True
commit: return branches containing this commit if is not None
+ remote: only remote tracking branches
Returns:
list of branch names
@@ -902,6 +903,8 @@
cmd += ['-a']
if commit:
cmd += ['--contains', commit]
+ if remote:
+ cmd.append('--remote')
result = []
for line in util.check_output(*cmd, cwd=git_repo).splitlines():