changeset 15769:afdf4f5bac61

encoding: use hint markup for "please check your locale settings" This will also make test-encoding.t pass on windows. The test would hit some other code path that already used hint markup.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 26 Dec 2011 15:01:06 +0100
parents cdf9c43445df
children 425c1309718f
files mercurial/encoding.py tests/test-encoding.t
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Mon Dec 26 15:30:43 2011 +0100
+++ b/mercurial/encoding.py	Mon Dec 26 15:01:06 2011 +0100
@@ -105,7 +105,7 @@
                 return localstr(u.encode('UTF-8'), r)
 
         except LookupError, k:
-            raise error.Abort("%s, please check your locale settings" % k)
+            raise error.Abort(k, hint="please check your locale settings")
         except UnicodeDecodeError:
             pass
     u = s.decode("utf-8", "replace") # last ditch
@@ -132,7 +132,7 @@
         sub = s[max(0, inst.start - 10):inst.start + 10]
         raise error.Abort("decoding near '%s': %s!" % (sub, inst))
     except LookupError, k:
-        raise error.Abort("%s, please check your locale settings" % k)
+        raise error.Abort(k, hint="please check your locale settings")
 
 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
 wide = (os.environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
--- a/tests/test-encoding.t	Mon Dec 26 15:30:43 2011 +0100
+++ b/tests/test-encoding.t	Mon Dec 26 15:01:06 2011 +0100
@@ -235,7 +235,8 @@
 hg log (dolphin)
 
   $ HGENCODING=dolphin hg log
-  abort: unknown encoding: dolphin, please check your locale settings
+  abort: unknown encoding: dolphin
+  (please check your locale settings)
   [255]
   $ HGENCODING=ascii hg branch `cat latin-1-tag`
   abort: decoding near '\xe9': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)