Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 11302:e1dde7363601
color: labeled text should be passed to ui.write() as ui.labeled
Some implementations of ui.label() (HTML versions in particular) must escape
the provided text and then markup the text with their tags. When this marked
up text is then passed to ui.write(), we must label the text as 'ui.labeled'
so the implementation knows not to escape it a second time (exposing the initial
markup).
This required the addition of a 'ui.plain' label for text that is purposefully
not marked up.
I was a little pedantic here, passing even ' ' strings to ui.label() when it
would be included with other labeled text in a ui.write() call. But it seemed
appropriate to lean to the side of caution.
author | Steve Borho <steve@borho.org> |
---|---|
date | Thu, 03 Jun 2010 23:18:18 -0500 |
parents | 3d0591a66118 |
children | a1aad8333864 ac873ecfc3c2 |
comparison
equal
deleted
inserted
replaced
11301:3d0591a66118 | 11302:e1dde7363601 |
---|---|
3278 | 3278 |
3279 t = ', '.join(t) | 3279 t = ', '.join(t) |
3280 cleanworkdir = False | 3280 cleanworkdir = False |
3281 | 3281 |
3282 if len(parents) > 1: | 3282 if len(parents) > 1: |
3283 t += _(' (merge)') | 3283 t += ui.label(_(' (merge)'), 'ui.plain') |
3284 elif branch != parents[0].branch(): | 3284 elif branch != parents[0].branch(): |
3285 t += _(' (new branch)') | 3285 t += ui.label(_(' (new branch)'), 'ui.plain') |
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 += _(' (head closed)') | 3288 t += ui.label(_(' (head closed)'), 'ui.plain') |
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 += _(' (clean)') | 3290 t += ui.label(_(' (clean)'), 'ui.plain') |
3291 cleanworkdir = True | 3291 cleanworkdir = True |
3292 elif pnode not in bheads: | 3292 elif pnode not in bheads: |
3293 t += _(' (new branch head)') | 3293 t += ui.label(_(' (new branch head)'), 'ui.plain') |
3294 | 3294 |
3295 if cleanworkdir: | 3295 if cleanworkdir: |
3296 ui.status(_('commit: %s\n') % t.strip()) | 3296 ui.status(_('commit: %s\n') % t.strip(), label='ui.labeled') |
3297 else: | 3297 else: |
3298 ui.write(_('commit: %s\n') % t.strip()) | 3298 ui.write(_('commit: %s\n') % t.strip(), label='ui.labeled') |
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) |
3302 cl = repo.changelog | 3302 cl = repo.changelog |
3303 for a in [cl.rev(n) for n in bheads]: | 3303 for a in [cl.rev(n) for n in bheads]: |