Show More
@@ -388,6 +388,9 ui:: | |||
|
388 | 388 | Print debugging information. True or False. Default is False. |
|
389 | 389 | editor;; |
|
390 | 390 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
391 | fallbackencoding;; | |
|
392 | Encoding to try if it's not possible to decode the changelog using | |
|
393 | UTF-8. Default is ISO-8859-1. | |
|
391 | 394 | ignore;; |
|
392 | 395 | A file to read per-user ignore patterns from. This file should be in |
|
393 | 396 | the same format as a repository-wide .hgignore file. This option |
@@ -72,6 +72,10 class localrepository(repo.repository): | |||
|
72 | 72 | self.manifest = manifest.manifest(self.sopener, v) |
|
73 | 73 | self.changelog = changelog.changelog(self.sopener, v) |
|
74 | 74 | |
|
75 | fallback = self.ui.config('ui', 'fallbackencoding') | |
|
76 | if fallback: | |
|
77 | util._fallbackencoding = fallback | |
|
78 | ||
|
75 | 79 | # the changelog might not have the inline index flag |
|
76 | 80 | # on. If the format of the changelog is the same as found in |
|
77 | 81 | # .hgrc, apply any flags found in the .hgrc as well. |
@@ -19,6 +19,7 demandload(globals(), "os threading time | |||
|
19 | 19 | |
|
20 | 20 | _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() |
|
21 | 21 | _encodingmode = os.environ.get("HGENCODINGMODE", "strict") |
|
22 | _fallbackencoding = 'ISO-8859-1' | |
|
22 | 23 | |
|
23 | 24 | def tolocal(s): |
|
24 | 25 | """ |
@@ -30,7 +31,7 def tolocal(s): | |||
|
30 | 31 | using UTF-8, then Latin-1, and failing that, we use UTF-8 and |
|
31 | 32 | replace unknown characters. |
|
32 | 33 | """ |
|
33 | for e in "utf-8 latin1".split(): | |
|
34 | for e in ('UTF-8', _fallbackencoding): | |
|
34 | 35 | try: |
|
35 | 36 | u = s.decode(e) # attempt strict decoding |
|
36 | 37 | return u.encode(_encoding, "replace") |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -47,3 +47,8 echo % latin-1 | |||
|
47 | 47 | HGENCODING=latin-1 hg branches |
|
48 | 48 | echo % utf-8 |
|
49 | 49 | HGENCODING=utf-8 hg branches |
|
50 | ||
|
51 | echo '[ui]' >> .hg/hgrc | |
|
52 | echo 'fallbackencoding = euc-jp' >> .hg/hgrc | |
|
53 | echo % utf-8 | |
|
54 | HGENCODING=utf-8 hg log |
@@ -1,7 +1,7 | |||
|
1 | 1 | adding changesets |
|
2 | 2 | adding manifests |
|
3 | 3 | adding file changes |
|
4 |
added |
|
|
4 | added 2 changesets with 2 changes to 1 files | |
|
5 | 5 | (run 'hg update' to get a working copy) |
|
6 | 6 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
7 | 7 | % should fail with encoding error |
@@ -15,104 +15,153 transaction abort! | |||
|
15 | 15 | rollback completed |
|
16 | 16 | % these should work |
|
17 | 17 | % ascii |
|
18 |
changeset: |
|
|
18 | changeset: 5:e4ed49b8a8f0 | |
|
19 | 19 | branch: ? |
|
20 | 20 | tag: tip |
|
21 | 21 | user: test |
|
22 | 22 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
23 | 23 | summary: latin1 branch |
|
24 | 24 | |
|
25 | changeset: 3:5edfc7acb541 | |
|
25 | changeset: 4:a02ca5a58e99 | |
|
26 | 26 | user: test |
|
27 | 27 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
28 |
summary: Added tag ? for changeset |
|
|
28 | summary: Added tag ? for changeset d47908dab82f | |
|
29 | 29 | |
|
30 |
changeset: |
|
|
30 | changeset: 3:d47908dab82f | |
|
31 | 31 | tag: ? |
|
32 | 32 | user: test |
|
33 | 33 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
34 | 34 | summary: utf-8 e' encoded: ? |
|
35 | 35 | |
|
36 | changeset: 1:6355cacf842e | |
|
36 | changeset: 2:9db1985f3097 | |
|
37 | 37 | user: test |
|
38 | 38 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
39 | 39 | summary: latin-1 e' encoded: ? |
|
40 | 40 | |
|
41 | changeset: 1:af6e0db4427c | |
|
42 | user: test | |
|
43 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
44 | summary: euc-jp: ?????? = u'\u65e5\u672c\u8a9e' | |
|
45 | ||
|
41 | 46 | changeset: 0:60aad1dd20a9 |
|
42 | 47 | user: test |
|
43 | 48 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
44 | 49 | summary: latin-1 e': ? |
|
45 | 50 | |
|
46 | 51 | % latin-1 |
|
47 |
changeset: |
|
|
52 | changeset: 5:e4ed49b8a8f0 | |
|
48 | 53 | branch: � |
|
49 | 54 | tag: tip |
|
50 | 55 | user: test |
|
51 | 56 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
52 | 57 | summary: latin1 branch |
|
53 | 58 | |
|
54 | changeset: 3:5edfc7acb541 | |
|
59 | changeset: 4:a02ca5a58e99 | |
|
55 | 60 | user: test |
|
56 | 61 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
57 |
summary: Added tag � for changeset |
|
|
62 | summary: Added tag � for changeset d47908dab82f | |
|
58 | 63 | |
|
59 |
changeset: |
|
|
64 | changeset: 3:d47908dab82f | |
|
60 | 65 | tag: � |
|
61 | 66 | user: test |
|
62 | 67 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
63 | 68 | summary: utf-8 e' encoded: � |
|
64 | 69 | |
|
65 | changeset: 1:6355cacf842e | |
|
70 | changeset: 2:9db1985f3097 | |
|
66 | 71 | user: test |
|
67 | 72 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
68 | 73 | summary: latin-1 e' encoded: � |
|
69 | 74 | |
|
75 | changeset: 1:af6e0db4427c | |
|
76 | user: test | |
|
77 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
78 | summary: euc-jp: ���ܸ� = u'\u65e5\u672c\u8a9e' | |
|
79 | ||
|
70 | 80 | changeset: 0:60aad1dd20a9 |
|
71 | 81 | user: test |
|
72 | 82 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
73 | 83 | summary: latin-1 e': � |
|
74 | 84 | |
|
75 | 85 | % utf-8 |
|
76 |
changeset: |
|
|
86 | changeset: 5:e4ed49b8a8f0 | |
|
77 | 87 | branch: é |
|
78 | 88 | tag: tip |
|
79 | 89 | user: test |
|
80 | 90 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
81 | 91 | summary: latin1 branch |
|
82 | 92 | |
|
83 | changeset: 3:5edfc7acb541 | |
|
93 | changeset: 4:a02ca5a58e99 | |
|
84 | 94 | user: test |
|
85 | 95 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
86 |
summary: Added tag é for changeset |
|
|
96 | summary: Added tag é for changeset d47908dab82f | |
|
87 | 97 | |
|
88 |
changeset: |
|
|
98 | changeset: 3:d47908dab82f | |
|
89 | 99 | tag: é |
|
90 | 100 | user: test |
|
91 | 101 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
92 | 102 | summary: utf-8 e' encoded: é |
|
93 | 103 | |
|
94 | changeset: 1:6355cacf842e | |
|
104 | changeset: 2:9db1985f3097 | |
|
95 | 105 | user: test |
|
96 | 106 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
97 | 107 | summary: latin-1 e' encoded: é |
|
98 | 108 | |
|
109 | changeset: 1:af6e0db4427c | |
|
110 | user: test | |
|
111 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
112 | summary: euc-jp: ÆüËܸì = u'\u65e5\u672c\u8a9e' | |
|
113 | ||
|
99 | 114 | changeset: 0:60aad1dd20a9 |
|
100 | 115 | user: test |
|
101 | 116 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
102 | 117 | summary: latin-1 e': é |
|
103 | 118 | |
|
104 | 119 | % ascii |
|
105 |
tip |
|
|
106 |
? |
|
|
120 | tip 5:e4ed49b8a8f0 | |
|
121 | ? 3:d47908dab82f | |
|
107 | 122 | % latin-1 |
|
108 |
tip |
|
|
109 |
� |
|
|
123 | tip 5:e4ed49b8a8f0 | |
|
124 | � 3:d47908dab82f | |
|
125 | % utf-8 | |
|
126 | tip 5:e4ed49b8a8f0 | |
|
127 | é 3:d47908dab82f | |
|
128 | % ascii | |
|
129 | ? 5:e4ed49b8a8f0 | |
|
130 | % latin-1 | |
|
131 | � 5:e4ed49b8a8f0 | |
|
132 | % utf-8 | |
|
133 | é 5:e4ed49b8a8f0 | |
|
110 | 134 | % utf-8 |
|
111 | tip 4:d8a5d9eaf41e | |
|
112 | é 2:91878608adb3 | |
|
113 | % ascii | |
|
114 | ? 4:d8a5d9eaf41e | |
|
115 | % latin-1 | |
|
116 | � 4:d8a5d9eaf41e | |
|
117 | % utf-8 | |
|
118 | é 4:d8a5d9eaf41e | |
|
135 | changeset: 5:e4ed49b8a8f0 | |
|
136 | branch: é | |
|
137 | tag: tip | |
|
138 | user: test | |
|
139 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
140 | summary: latin1 branch | |
|
141 | ||
|
142 | changeset: 4:a02ca5a58e99 | |
|
143 | user: test | |
|
144 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
145 | summary: Added tag é for changeset d47908dab82f | |
|
146 | ||
|
147 | changeset: 3:d47908dab82f | |
|
148 | tag: é | |
|
149 | user: test | |
|
150 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
151 | summary: utf-8 e' encoded: é | |
|
152 | ||
|
153 | changeset: 2:9db1985f3097 | |
|
154 | user: test | |
|
155 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
156 | summary: latin-1 e' encoded: é | |
|
157 | ||
|
158 | changeset: 1:af6e0db4427c | |
|
159 | user: test | |
|
160 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
161 | summary: euc-jp: 日本語 = u'\u65e5\u672c\u8a9e' | |
|
162 | ||
|
163 | changeset: 0:60aad1dd20a9 | |
|
164 | user: test | |
|
165 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
166 | summary: latin-1 e': � | |
|
167 |
General Comments 0
You need to be logged in to leave comments.
Login now