from re import match, sub

class commit:
	def __init__(self, commit_list):
		self.__hash = ""
		self.__merge = ""
		self.__author = ""
		self.__date = ""
		self.__message = []

		for line in commit_list:
			if match("^commit", line):
				line = sub("^commit", "", line)
				line = line.strip()
				self.__hash = line
			elif match("^Merge:", line):
				line = sub("^Merge:", "", line)
				line = line.strip()
				self.__merge = line
			elif match("^Author:", line):
				line = sub("^Author:", "", line)
				line = line.strip()
				self.__author = line
			elif match("^Date:", line):
				line = sub("^Date:", "", line)
				line = line.strip()
				self.__date = line
			else:
				line = line.strip()
				self.__message.append(line)

	def hash(self):
		return self.__hash

	def merge(self):
		return self.__merge

	def author(self):
		return self.__author

	def date(self):
		return self.__date

	def message(self):
		return self.__message

