branches: Enable output of multiple projects
Fixes a bug introduced by 498a0e8a79ab76eeb6adc40f12b04d59820716f9
("Make 'repo branches -a' the default behavior").
Change-Id: Ib739f82f4647890c46d7c9fb2f2e63a16a0481de
diff --git a/subcmds/branches.py b/subcmds/branches.py
index 0e3ab3c..a4f8d36 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -136,7 +136,7 @@
hdr('%c%c %-*s' % (current, published, width, name))
out.write(' |')
- if in_cnt < project_cnt and (in_cnt == 1):
+ if in_cnt < project_cnt:
fmt = out.write
paths = []
if in_cnt < project_cnt - in_cnt:
@@ -150,15 +150,17 @@
for b in i.projects:
have.add(b.project)
for p in projects:
- paths.append(p.relpath)
+ if not p in have:
+ paths.append(p.relpath)
s = ' %s %s' % (type, ', '.join(paths))
if width + 7 + len(s) < 80:
fmt(s)
else:
- out.nl()
- fmt(' %s:' % type)
+ fmt(' %s:' % type)
for p in paths:
out.nl()
- fmt(' %s' % p)
+ fmt(width*' ' + ' %s' % p)
+ else:
+ out.write(' in all projects')
out.nl()