##// END OF EJS Templates
branches: reduce nesting in for loop
Yuya Nishihara -
r22639:79c4178b default
parent child Browse files
Show More
@@ -1104,28 +1104,29 b' def branches(ui, repo, active=False, clo'
1104 reverse=True)
1104 reverse=True)
1105
1105
1106 for tag, ctx, isactive, isopen in branches:
1106 for tag, ctx, isactive, isopen in branches:
1107 if (not active) or isactive:
1107 if active and not isactive:
1108 if isactive:
1108 continue
1109 label = 'branches.active'
1109 if isactive:
1110 notice = ''
1110 label = 'branches.active'
1111 elif not isopen:
1111 notice = ''
1112 if not closed:
1112 elif not isopen:
1113 continue
1113 if not closed:
1114 label = 'branches.closed'
1114 continue
1115 notice = _(' (closed)')
1115 label = 'branches.closed'
1116 else:
1116 notice = _(' (closed)')
1117 label = 'branches.inactive'
1117 else:
1118 notice = _(' (inactive)')
1118 label = 'branches.inactive'
1119 if tag == repo.dirstate.branch():
1119 notice = _(' (inactive)')
1120 label = 'branches.current'
1120 if tag == repo.dirstate.branch():
1121 rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag))
1121 label = 'branches.current'
1122 rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())),
1122 rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag))
1123 'log.changeset changeset.%s' % ctx.phasestr())
1123 rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())),
1124 labeledtag = ui.label(tag, label)
1124 'log.changeset changeset.%s' % ctx.phasestr())
1125 if ui.quiet:
1125 labeledtag = ui.label(tag, label)
1126 ui.write("%s\n" % labeledtag)
1126 if ui.quiet:
1127 else:
1127 ui.write("%s\n" % labeledtag)
1128 ui.write("%s %s%s\n" % (labeledtag, rev, notice))
1128 else:
1129 ui.write("%s %s%s\n" % (labeledtag, rev, notice))
1129
1130
1130 @command('bundle',
1131 @command('bundle',
1131 [('f', 'force', None, _('run even when the destination is unrelated')),
1132 [('f', 'force', None, _('run even when the destination is unrelated')),
General Comments 0
You need to be logged in to leave comments. Login now