OBJECT_ID = "object"
TYPE_ID = "type"
TAGGER_ID = "tagger"
+ENCODING_ID = "encoding"
S_IFGITLINK = 0160000
def S_ISGITLINK(m):
def __init__(self):
super(Commit, self).__init__()
self._parents = []
+ self._encoding = None
self._needs_parsing = False
self._needs_serialization = True
self._committer, timetext, timezonetext = value.rsplit(" ", 2)
self._commit_time = int(timetext)
self._commit_timezone = parse_timezone(timezonetext)
+ elif field == ENCODING_ID:
+ self._encoding = value
else:
raise AssertionError("Unknown field %s" % field)
self._message = f.read()
f.write("%s %s\n" % (PARENT_ID, p))
f.write("%s %s %s %s\n" % (AUTHOR_ID, self._author, str(self._author_time), format_timezone(self._author_timezone)))
f.write("%s %s %s %s\n" % (COMMITTER_ID, self._committer, str(self._commit_time), format_timezone(self._commit_timezone)))
+ if self.encoding:
+ f.write("%s %s\n" % (ENCODING_ID, self.encoding))
f.write("\n") # There must be a new line after the headers
f.write(self._message)
self._text = f.getvalue()
author_timezone = serializable_property("author_timezone",
"Returns the zone the author time is in.")
+ encoding = serializable_property("encoding",
+ "Encoding of the commit message.")
+
type_map = {
BLOB_ID : Blob,
c.message = 'Merge ../b\n'
return c
+ def test_encoding(self):
+ c = self.make_base()
+ c.encoding = "iso8859-1"
+ self.assertTrue("encoding iso8859-1\n" in c.as_raw_string())
+
def test_short_timestamp(self):
c = self.make_base()
c.commit_time = 30