From a535ae441824171428877ce877a3b97c38548a85 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Thu, 13 Jan 2022 21:08:24 +0000 Subject: [PATCH] branches: Fix "not in" handling If the branch is current, or present in less than half of the projects, list which projects it is *in*. Otherwise, correctly detect which projects (by relpath) it is not in. Previously, the "not in" path would incorrectly list all projects. Change-Id: Ia153856f577035a51f538b7bf5d3135b70c69d52 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/328199 Tested-by: LaMont Jones Reviewed-by: Xin Li --- subcmds/branches.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subcmds/branches.py b/subcmds/branches.py index 6d975ed4..7b5decc6 100644 --- a/subcmds/branches.py +++ b/subcmds/branches.py @@ -151,7 +151,7 @@ is shown, then the branch appears in all projects. fmt = out.write paths = [] non_cur_paths = [] - if i.IsSplitCurrent or (in_cnt < project_cnt - in_cnt): + if i.IsSplitCurrent or (in_cnt <= project_cnt - in_cnt): in_type = 'in' for b in i.projects: if not i.IsSplitCurrent or b.current: @@ -163,9 +163,9 @@ is shown, then the branch appears in all projects. in_type = 'not in' have = set() for b in i.projects: - have.add(b.project) + have.add(b.project.relpath) for p in projects: - if p not in have: + if p.relpath not in have: paths.append(p.relpath) s = ' %s %s' % (in_type, ', '.join(paths))