diff options
| author | LaMont Jones <lamontjones@google.com> | 2022-01-13 21:08:24 +0000 |
|---|---|---|
| committer | LaMont Jones <lamontjones@google.com> | 2022-01-21 17:20:21 +0000 |
| commit | a535ae441824171428877ce877a3b97c38548a85 (patch) | |
| tree | 8e4834a4773467ea7037e23e46cd2ad4747714c3 /subcmds | |
| parent | 67d6cdf2bc752f02cd294abe3a45811c2019de35 (diff) | |
| download | git-repo-a535ae441824171428877ce877a3b97c38548a85.tar.gz | |
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 <lamontjones@google.com>
Reviewed-by: Xin Li <delphij@google.com>
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/branches.py | 6 |
1 files 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. | |||
| 151 | fmt = out.write | 151 | fmt = out.write |
| 152 | paths = [] | 152 | paths = [] |
| 153 | non_cur_paths = [] | 153 | non_cur_paths = [] |
| 154 | if i.IsSplitCurrent or (in_cnt < project_cnt - in_cnt): | 154 | if i.IsSplitCurrent or (in_cnt <= project_cnt - in_cnt): |
| 155 | in_type = 'in' | 155 | in_type = 'in' |
| 156 | for b in i.projects: | 156 | for b in i.projects: |
| 157 | if not i.IsSplitCurrent or b.current: | 157 | if not i.IsSplitCurrent or b.current: |
| @@ -163,9 +163,9 @@ is shown, then the branch appears in all projects. | |||
| 163 | in_type = 'not in' | 163 | in_type = 'not in' |
| 164 | have = set() | 164 | have = set() |
| 165 | for b in i.projects: | 165 | for b in i.projects: |
| 166 | have.add(b.project) | 166 | have.add(b.project.relpath) |
| 167 | for p in projects: | 167 | for p in projects: |
| 168 | if p not in have: | 168 | if p.relpath not in have: |
| 169 | paths.append(p.relpath) | 169 | paths.append(p.relpath) |
| 170 | 170 | ||
| 171 | s = ' %s %s' % (in_type, ', '.join(paths)) | 171 | s = ' %s %s' % (in_type, ', '.join(paths)) |
