mercurial/commands.py
changeset 22639 79c4178b2169
parent 22634 e48a5d3996c2
child 22641 ffd0f6b1c29d
equal deleted inserted replaced
22638:0d0350cfc7ab 22639:79c4178b2169
  1102         branches.append((tag, repo[tip], isactive, not isclosed))
  1102         branches.append((tag, repo[tip], isactive, not isclosed))
  1103     branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]),
  1103     branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]),
  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')),
  1132     ('r', 'rev', [], _('a changeset intended to be added to the destination'),
  1133     ('r', 'rev', [], _('a changeset intended to be added to the destination'),
  1133      _('REV')),
  1134      _('REV')),