Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 13047:6c375e07d673
branch: operate on branch names in local string space where possible
Previously, branch names were ideally manipulated as UTF-8 strings,
because they were stored as UTF-8 in the dirstate and the changelog
and could not be safely converted to the local encoding and back.
However, only about 80% of branch name code was actually using the
right encoding conventions. This patch uses the localstr addition to
allow working on branch names as local strings, which simplifies
handling so that the previously incorrect code becomes correct.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 24 Nov 2010 15:56:32 -0600 |
parents | 6e0a9f9227bd |
children | 79184986658c |
comparison
equal
deleted
inserted
replaced
13046:7cc4263e07a9 | 13047:6c375e07d673 |
---|---|
799 label='log.changeset') | 799 label='log.changeset') |
800 | 800 |
801 branch = ctx.branch() | 801 branch = ctx.branch() |
802 # don't show the default branch name | 802 # don't show the default branch name |
803 if branch != 'default': | 803 if branch != 'default': |
804 branch = encoding.tolocal(branch) | |
805 self.ui.write(_("branch: %s\n") % branch, | 804 self.ui.write(_("branch: %s\n") % branch, |
806 label='log.branch') | 805 label='log.branch') |
807 for tag in self.repo.nodetags(changenode): | 806 for tag in self.repo.nodetags(changenode): |
808 self.ui.write(_("tag: %s\n") % tag, | 807 self.ui.write(_("tag: %s\n") % tag, |
809 label='log.tag') | 808 label='log.tag') |
1355 edittext.append("HG: --") | 1354 edittext.append("HG: --") |
1356 edittext.append(_("HG: user: %s") % ctx.user()) | 1355 edittext.append(_("HG: user: %s") % ctx.user()) |
1357 if ctx.p2(): | 1356 if ctx.p2(): |
1358 edittext.append(_("HG: branch merge")) | 1357 edittext.append(_("HG: branch merge")) |
1359 if ctx.branch(): | 1358 if ctx.branch(): |
1360 edittext.append(_("HG: branch '%s'") | 1359 edittext.append(_("HG: branch '%s'") % ctx.branch()) |
1361 % encoding.tolocal(ctx.branch())) | |
1362 edittext.extend([_("HG: subrepo %s") % s for s in subs]) | 1360 edittext.extend([_("HG: subrepo %s") % s for s in subs]) |
1363 edittext.extend([_("HG: added %s") % f for f in added]) | 1361 edittext.extend([_("HG: added %s") % f for f in added]) |
1364 edittext.extend([_("HG: changed %s") % f for f in modified]) | 1362 edittext.extend([_("HG: changed %s") % f for f in modified]) |
1365 edittext.extend([_("HG: removed %s") % f for f in removed]) | 1363 edittext.extend([_("HG: removed %s") % f for f in removed]) |
1366 if not added and not modified and not removed: | 1364 if not added and not modified and not removed: |