##// END OF EJS Templates
Backed out changeset: e1dde7363601
Steve Borho -
r11310:ac873ecf default
parent child Browse files
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" % (ui.label(pad(name, maxname),
153 return "%s %15s %s%s\n" % (pad(name, maxname),
154 'ui.plain'),
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 ui.label("%s %6d %s\n" % (pad(name, maxname), sum(count),
162 return "%s %6d %s\n" % (pad(name, maxname), sum(count),
165 '*' * charnum(sum(count))), 'ui.plain')
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), label='ui.labeled')
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 out = ['%s: ' % ui.label(q.series[idx], 'qguard.patch')]
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 out.append(ui.label(guard, 'qguard.positive'))
2151 ui.write(guard, label='qguard.positive')
2152 elif guard.startswith('-'):
2152 elif guard.startswith('-'):
2153 out.append(ui.label(guard, 'qguard.negative'))
2153 ui.write(guard, label='qguard.negative')
2154 else:
2154 else:
2155 out.append(ui.label(guard, 'qguard.unguarded'))
2155 ui.write(guard, label='qguard.unguarded')
2156 if i != len(guards) - 1:
2156 if i != len(guards) - 1:
2157 out.append(ui.label(' ', 'ui.plain'))
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)
@@ -2799,8 +2799,7 b' def summary(orig, ui, repo, *args, **kwa'
2799 if u:
2799 if u:
2800 m.append(ui.label(_("%d unapplied"), 'qseries.unapplied') % u)
2800 m.append(ui.label(_("%d unapplied"), 'qseries.unapplied') % u)
2801 if m:
2801 if m:
2802 ui.write("mq: ")
2802 ui.write("mq: %s\n" % ', '.join(m))
2803 ui.write(', '.join(m) + '\n', label='ui.labeled')
2804 else:
2803 else:
2805 ui.note(_("mq: (empty queue)\n"))
2804 ui.note(_("mq: (empty queue)\n"))
2806 return r
2805 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 += ui.label(_(' (merge)'), 'ui.plain')
3283 t += _(' (merge)')
3284 elif branch != parents[0].branch():
3284 elif branch != parents[0].branch():
3285 t += ui.label(_(' (new branch)'), 'ui.plain')
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 += ui.label(_(' (head closed)'), 'ui.plain')
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 += ui.label(_(' (clean)'), 'ui.plain')
3290 t += _(' (clean)')
3291 cleanworkdir = True
3291 cleanworkdir = True
3292 elif pnode not in bheads:
3292 elif pnode not in bheads:
3293 t += ui.label(_(' (new branch head)'), 'ui.plain')
3293 t += _(' (new branch head)')
3294
3294
3295 if cleanworkdir:
3295 if cleanworkdir:
3296 ui.status(_('commit: %s\n') % t.strip(), label='ui.labeled')
3296 ui.status(_('commit: %s\n') % t.strip())
3297 else:
3297 else:
3298 ui.write(_('commit: %s\n') % t.strip(), label='ui.labeled')
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