Comments
Patch
@@ -147,17 +147,17 @@ class changelogrevision(object):
Changelog revisions consist of multiple pieces of data, including
the manifest node, user, and date. This object exposes a view into
the parsed object.
"""
__slots__ = (
'date',
- 'description',
+ '_rawdesc',
'extra',
'files',
'manifest',
'user',
)
def __new__(cls, text):
if not text:
@@ -180,19 +180,20 @@ class changelogrevision(object):
# time tz extra\n : date (time is int or float, timezone is int)
# : extra is metadata, encoded and separated by '\0'
# : older versions ignore it
# files\n\n : files modified by the cset, no \n or \r allowed
# (.*) : comment (free text, ideally utf-8)
#
# changelog v0 doesn't use extra
- last = text.index("\n\n")
- self.description = encoding.tolocal(text[last + 2:])
- l = text[:last].split('\n')
+ doublenl = text.index('\n\n')
+ self._rawdesc = text[doublenl + 2:]
+
+ l = text[:doublenl].split('\n')
self.manifest = bin(l[0])
self.user = encoding.tolocal(l[1])
tdata = l[2].split(' ', 2)
if len(tdata) != 3:
time = float(tdata[0])
try:
# various tools did silly things with the time zone field.
@@ -204,16 +205,20 @@ class changelogrevision(object):
time, timezone = float(tdata[0]), int(tdata[1])
self.extra = decodeextra(tdata[2])
self.date = (time, timezone)
self.files = l[3:]
return self
+ @property
+ def description(self):
+ return encoding.tolocal(self._rawdesc)
+
class changelog(revlog.revlog):
def __init__(self, opener):
revlog.revlog.__init__(self, opener, "00changelog.i")
if self._initempty:
# changelogs don't benefit from generaldelta
self.version &= ~revlog.REVLOGGENERALDELTA
self._generaldelta = False
self._realopener = opener