[PATCH 1 of 8] use UTF-8 to encode/decode log text

Matt Mackall mpm at selenic.com
Mon Nov 20 10:55:44 CST 2006


On Mon, Nov 20, 2006 at 05:29:51PM +0700, Andrey wrote:
> # HG changeset patch
> # User Andrey <grooz-work at gorodok.net>
> # Date 1163269770 -21600
> # Node ID c1622a4837a2483233b0d19b2ad2ea64b919f53e
> # Parent  975c2469c31683308fd688721ffb27b567feb770
> use UTF-8 to encode/decode log text
> 
> diff -r 975c2469c316 -r c1622a4837a2 mercurial/changelog.py
> --- a/mercurial/changelog.py	Sun Nov 19 16:32:36 2006 -0600
> +++ b/mercurial/changelog.py	Sun Nov 12 00:29:30 2006 +0600
> @@ -9,6 +9,8 @@ from i18n import gettext as _
>  from i18n import gettext as _
>  from demandload import demandload
>  demandload(globals(), "os time util")
> +
> +CHANGELOG_ENCODING="UTF-8"
>  
>  def _string_escape(text):
>      """
> @@ -60,6 +62,7 @@ class changelog(revlog):
>          """
>          if not text:
>              return (nullid, "", (0, 0), [], "", {})
> +        text = unicode(text, CHANGELOG_ENCODING)

This is still going to throw exceptions on existing repos, right?
That's absolutely not acceptable.

Again, this should go in util and be robust. And don't bother with
making a CHANGELOG_ENCODING variable, please.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list