Show More
@@ -150,10 +150,8 b' def churn(ui, repo, *pats, **opts):' | |||||
150 | if opts.get('diffstat'): |
|
150 | if opts.get('diffstat'): | |
151 | width -= 15 |
|
151 | width -= 15 | |
152 | def format(name, (added, removed)): |
|
152 | def format(name, (added, removed)): | |
153 |
return "%s %15s %s%s\n" % ( |
|
153 | return "%s %15s %s%s\n" % (pad(name, maxname), | |
154 |
|
|
154 | '+%d/-%d' % (added, removed), | |
155 | ui.label('+%d/-%d' % (added, removed), |
|
|||
156 | 'ui.plain'), |
|
|||
157 | ui.label('+' * charnum(added), |
|
155 | ui.label('+' * charnum(added), | |
158 | 'diffstat.inserted'), |
|
156 | 'diffstat.inserted'), | |
159 | ui.label('-' * charnum(removed), |
|
157 | ui.label('-' * charnum(removed), | |
@@ -161,14 +159,14 b' def churn(ui, repo, *pats, **opts):' | |||||
161 | else: |
|
159 | else: | |
162 | width -= 6 |
|
160 | width -= 6 | |
163 | def format(name, count): |
|
161 | def format(name, count): | |
164 |
return |
|
162 | return "%s %6d %s\n" % (pad(name, maxname), sum(count), | |
165 |
'*' * charnum(sum(count))) |
|
163 | '*' * charnum(sum(count))) | |
166 |
|
164 | |||
167 | def charnum(count): |
|
165 | def charnum(count): | |
168 | return int(round(count * width / maxcount)) |
|
166 | return int(round(count * width / maxcount)) | |
169 |
|
167 | |||
170 | for name, count in rate: |
|
168 | for name, count in rate: | |
171 |
ui.write(format(name, count) |
|
169 | ui.write(format(name, count)) | |
172 |
|
170 | |||
173 |
|
171 | |||
174 | cmdtable = { |
|
172 | cmdtable = { |
@@ -108,9 +108,7 b' from mercurial.i18n import _' | |||||
108 | 'status.ignored': 'black bold', |
|
108 | 'status.ignored': 'black bold', | |
109 | 'status.modified': 'blue bold', |
|
109 | 'status.modified': 'blue bold', | |
110 | 'status.removed': 'red bold', |
|
110 | 'status.removed': 'red bold', | |
111 |
'status.unknown': 'magenta bold underline' |
|
111 | 'status.unknown': 'magenta bold underline'} | |
112 | 'ui.labeled': 'none', |
|
|||
113 | 'ui.plain': 'none'} |
|
|||
114 |
|
112 | |||
115 |
|
113 | |||
116 | def render_effects(text, effects): |
|
114 | def render_effects(text, effects): | |
@@ -144,8 +142,6 b' def configstyles(ui):' | |||||
144 |
|
142 | |||
145 | _buffers = None |
|
143 | _buffers = None | |
146 | def style(msg, label): |
|
144 | def style(msg, label): | |
147 | if label in ('ui.plain', 'ui.labeled'): |
|
|||
148 | return msg |
|
|||
149 | effects = [] |
|
145 | effects = [] | |
150 | for l in label.split(): |
|
146 | for l in label.split(): | |
151 | s = _styles.get(l, '') |
|
147 | s = _styles.get(l, '') |
@@ -2145,17 +2145,17 b' def guard(ui, repo, *args, **opts):' | |||||
2145 | ''' |
|
2145 | ''' | |
2146 | def status(idx): |
|
2146 | def status(idx): | |
2147 | guards = q.series_guards[idx] or ['unguarded'] |
|
2147 | guards = q.series_guards[idx] or ['unguarded'] | |
2148 |
|
|
2148 | ui.write('%s: ' % ui.label(q.series[idx], 'qguard.patch')) | |
2149 | for i, guard in enumerate(guards): |
|
2149 | for i, guard in enumerate(guards): | |
2150 | if guard.startswith('+'): |
|
2150 | if guard.startswith('+'): | |
2151 |
|
|
2151 | ui.write(guard, label='qguard.positive') | |
2152 | elif guard.startswith('-'): |
|
2152 | elif guard.startswith('-'): | |
2153 |
|
|
2153 | ui.write(guard, label='qguard.negative') | |
2154 | else: |
|
2154 | else: | |
2155 |
|
|
2155 | ui.write(guard, label='qguard.unguarded') | |
2156 | if i != len(guards) - 1: |
|
2156 | if i != len(guards) - 1: | |
2157 |
|
|
2157 | ui.write(' ') | |
2158 | ui.write(''.join(out) + '\n', label='ui.labeled') |
|
2158 | ui.write('\n') | |
2159 | q = repo.mq |
|
2159 | q = repo.mq | |
2160 | patch = None |
|
2160 | patch = None | |
2161 | args = list(args) |
|
2161 | args = list(args) | |
@@ -2800,8 +2800,7 b' def summary(orig, ui, repo, *args, **kwa' | |||||
2800 | if u: |
|
2800 | if u: | |
2801 | m.append(ui.label(_("%d unapplied"), 'qseries.unapplied') % u) |
|
2801 | m.append(ui.label(_("%d unapplied"), 'qseries.unapplied') % u) | |
2802 | if m: |
|
2802 | if m: | |
2803 | ui.write("mq: ") |
|
2803 | ui.write("mq: %s\n" % ', '.join(m)) | |
2804 | ui.write(', '.join(m) + '\n', label='ui.labeled') |
|
|||
2805 | else: |
|
2804 | else: | |
2806 | ui.note(_("mq: (empty queue)\n")) |
|
2805 | ui.note(_("mq: (empty queue)\n")) | |
2807 | return r |
|
2806 | return r |
@@ -3280,22 +3280,22 b' def summary(ui, repo, **opts):' | |||||
3280 | cleanworkdir = False |
|
3280 | cleanworkdir = False | |
3281 |
|
3281 | |||
3282 | if len(parents) > 1: |
|
3282 | if len(parents) > 1: | |
3283 |
t += |
|
3283 | t += _(' (merge)') | |
3284 | elif branch != parents[0].branch(): |
|
3284 | elif branch != parents[0].branch(): | |
3285 |
t += |
|
3285 | t += _(' (new branch)') | |
3286 | elif (parents[0].extra().get('close') and |
|
3286 | elif (parents[0].extra().get('close') and | |
3287 | pnode in repo.branchheads(branch, closed=True)): |
|
3287 | pnode in repo.branchheads(branch, closed=True)): | |
3288 |
t += |
|
3288 | t += _(' (head closed)') | |
3289 | elif (not st[0] and not st[1] and not st[2] and not st[7]): |
|
3289 | elif (not st[0] and not st[1] and not st[2] and not st[7]): | |
3290 |
t += |
|
3290 | t += _(' (clean)') | |
3291 | cleanworkdir = True |
|
3291 | cleanworkdir = True | |
3292 | elif pnode not in bheads: |
|
3292 | elif pnode not in bheads: | |
3293 |
t += |
|
3293 | t += _(' (new branch head)') | |
3294 |
|
3294 | |||
3295 | if cleanworkdir: |
|
3295 | if cleanworkdir: | |
3296 |
ui.status(_('commit: %s\n') % t.strip() |
|
3296 | ui.status(_('commit: %s\n') % t.strip()) | |
3297 | else: |
|
3297 | else: | |
3298 |
ui.write(_('commit: %s\n') % t.strip() |
|
3298 | ui.write(_('commit: %s\n') % t.strip()) | |
3299 |
|
3299 | |||
3300 | # all ancestors of branch heads - all ancestors of parent = new csets |
|
3300 | # all ancestors of branch heads - all ancestors of parent = new csets | |
3301 | new = [0] * len(repo) |
|
3301 | new = [0] * len(repo) |
@@ -546,9 +546,5 b' class ui(object):' | |||||
546 |
|
546 | |||
547 | ui.write(s, 'label') is equivalent to |
|
547 | ui.write(s, 'label') is equivalent to | |
548 | ui.write(ui.label(s, 'label')). |
|
548 | ui.write(ui.label(s, 'label')). | |
549 |
|
||||
550 | Callers of ui.label() should pass labeled text back to |
|
|||
551 | ui.write() with a label of 'ui.labeled' so implementations know |
|
|||
552 | that the text has already been escaped and marked up. |
|
|||
553 | ''' |
|
549 | ''' | |
554 | return msg |
|
550 | return msg |
General Comments 0
You need to be logged in to leave comments.
Login now