Skip to content

Commit 4fd7b94

Browse files
author
firm1
committed
add support of utf8
1 parent d83f6e8 commit 4fd7b94

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎git/refs/log.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@
3232
class RefLogEntry(tuple):
3333

3434
"""Named tuple allowing easy access to the revlog data fields"""
35-
_fmt = "%s %s %s <%s> %i %s\t%s\n"
3635
_re_hexsha_only = re.compile('^[0-9A-Fa-f]{40}$')
3736
__slots__ = tuple()
3837

3938
def __repr__(self):
4039
"""Representation of ourselves in git reflog format"""
4140
act = self.actor
4241
time = self.time
43-
return self._fmt % (self.oldhexsha, self.newhexsha, act.name, act.email,
44-
time[0], altz_to_utctz_str(time[1]), self.message)
45-
42+
return u"{0} {1} {2} <{3}> {4!s} {5}\t{6}\n".format(self.oldhexsha, self.newhexsha, act.name, act.email,
43+
time[0], altz_to_utctz_str(time[1]), self.message).encode("utf-8")
4644
@property
4745
def oldhexsha(self):
4846
"""The hexsha to the commit the ref pointed to before the change"""
@@ -267,7 +265,6 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
267265

268266
lf = LockFile(filepath)
269267
lf._obtain_lock_or_raise()
270-
271268
fd = open(filepath, 'ab')
272269
try:
273270
fd.write(repr(entry).encode(defenc))

0 commit comments

Comments
 (0)