Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add support of utf8
  • Loading branch information
firm1 committed Jan 7, 2015
commit 4fd7b945dfca73caf00883d4cf43740edb7516df
7 changes: 2 additions & 5 deletions git/refs/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@
class RefLogEntry(tuple):

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

def __repr__(self):
"""Representation of ourselves in git reflog format"""
act = self.actor
time = self.time
return self._fmt % (self.oldhexsha, self.newhexsha, act.name, act.email,
time[0], altz_to_utctz_str(time[1]), self.message)

return u"{0} {1} {2} <{3}> {4!s} {5}\t{6}\n".format(self.oldhexsha, self.newhexsha, act.name, act.email,
time[0], altz_to_utctz_str(time[1]), self.message).encode("utf-8")
@property
def oldhexsha(self):
"""The hexsha to the commit the ref pointed to before the change"""
Expand Down Expand Up @@ -267,7 +265,6 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):

lf = LockFile(filepath)
lf._obtain_lock_or_raise()

fd = open(filepath, 'ab')
try:
fd.write(repr(entry).encode(defenc))
Expand Down