Mercurial > hg
comparison hgext/churn.py @ 21163:9846b40d01e7 stable
churn: compute padding with unicode strings
Most UTF-8 aware terminals convert multibyte sequences into a single displayed
characters. Because the first column is padded by counting bytes, the second
column is not perfectly aligned in the presence of non ASCII characters.
author | Isaac Jurado <diptongo@gmail.com> |
---|---|
date | Sat, 19 Apr 2014 15:11:25 +0200 |
parents | e96e9f805c19 |
children | 75c8720092ba |
comparison
equal
deleted
inserted
replaced
21162:d924e387604f | 21163:9846b40d01e7 |
---|---|
8 | 8 |
9 '''command to display statistics about repository history''' | 9 '''command to display statistics about repository history''' |
10 | 10 |
11 from mercurial.i18n import _ | 11 from mercurial.i18n import _ |
12 from mercurial import patch, cmdutil, scmutil, util, templater, commands | 12 from mercurial import patch, cmdutil, scmutil, util, templater, commands |
13 from mercurial import encoding | |
13 import os | 14 import os |
14 import time, datetime | 15 import time, datetime |
15 | 16 |
16 testedwith = 'internal' | 17 testedwith = 'internal' |
17 | 18 |
122 Such a file may be specified with the --aliases option, otherwise | 123 Such a file may be specified with the --aliases option, otherwise |
123 a .hgchurn file will be looked for in the working directory root. | 124 a .hgchurn file will be looked for in the working directory root. |
124 Aliases will be split from the rightmost "=". | 125 Aliases will be split from the rightmost "=". |
125 ''' | 126 ''' |
126 def pad(s, l): | 127 def pad(s, l): |
127 return (s + " " * l)[:l] | 128 return s + " " * (l - encoding.colwidth(s)) |
128 | 129 |
129 amap = {} | 130 amap = {} |
130 aliases = opts.get('aliases') | 131 aliases = opts.get('aliases') |
131 if not aliases and os.path.exists(repo.wjoin('.hgchurn')): | 132 if not aliases and os.path.exists(repo.wjoin('.hgchurn')): |
132 aliases = repo.wjoin('.hgchurn') | 133 aliases = repo.wjoin('.hgchurn') |