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

Andrey grooz-work at gorodok.net
Mon Nov 20 10:29:51 UTC 2006


# 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)
         last = text.index("\n\n")
         desc = text[last + 2:]
         l = text[:last].split('\n')
@@ -98,4 +101,4 @@ class changelog(revlog):
         list.sort()
         l = [hex(manifest), user, parseddate] + list + ["", desc]
         text = "\n".join(l)
-        return self.addrevision(text, transaction, self.count(), p1, p2)
+        return self.addrevision(text.encode(CHANGELOG_ENCODING), transaction, self.count(), p1, p2)



More information about the Mercurial-devel mailing list