[PATCH 09 of 10] py3: use unicode literals in changelog.py

Pulkit Goyal 7895pulkit at gmail.com
Tue Aug 2 16:27:31 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1470169051 -19800
#      Wed Aug 03 01:47:31 2016 +0530
# Node ID bb24dfbbd410cd78646c43557c06475f9d252dd5
# Parent  f7cb9b3eeac9c22dc76f6c5976fda488ba992be2
py3: use unicode literals in changelog.py

collections.namedtuple type and field names must be str in Python 3.
Our custom module importer was rewriting them to bytes literals,
making this fail.

In addition, __slots__ values must also be unicode.

diff -r f7cb9b3eeac9 -r bb24dfbbd410 mercurial/changelog.py
--- a/mercurial/changelog.py	Wed Aug 03 01:43:25 2016 +0530
+++ b/mercurial/changelog.py	Wed Aug 03 01:47:31 2016 +0530
@@ -138,9 +138,9 @@
         return appender(opener, name, mode, buf)
     return _delay
 
-_changelogrevision = collections.namedtuple('changelogrevision',
-                                            ('manifest', 'user', 'date',
-                                             'files', 'description', 'extra'))
+_changelogrevision = collections.namedtuple(u'changelogrevision',
+                                            (u'manifest', u'user', u'date',
+                                             u'files', u'description', u'extra'))
 
 class changelogrevision(object):
     """Holds results of a parsed changelog revision.
@@ -151,8 +151,8 @@
     """
 
     __slots__ = (
-        '_offsets',
-        '_text',
+        u'_offsets',
+        u'_text',
     )
 
     def __new__(cls, text):


More information about the Mercurial-devel mailing list