def add_pre_msg():
    commit_msg_file = sys.argv[1]
    with open(commit_msg_file, 'r+') as f:
        text = list()
        while True:
            line = f.readline()
            if (not line):
                break
            text.append(line)
        pre = ('[version : %s] [srv-crc16 : %04X]\n' % (get_version(), get_srv_crc()))
        if check_first_line(text[0]):
            text[0] = pre
        else:
            text.insert(0, pre)
        f.seek(0)
        f.truncate()
        f.writelines(text)
def add_pre_msg():
    commit_msg_file = sys.argv[1]
    with open(commit_msg_file, 'r+') as f:
        text = list()
        while True:
            line = f.readline()
            if (not line):
                break
            text.append(line)
        pre = ('[version : %s] [srv-crc16 : %04X]\n' % (get_version(), get_srv_crc()))
        if check_first_line(text[0]):
            text[0] = pre
        else:
            text.insert(0, pre)
        f.seek(0)
        f.truncate()
        f.writelines(text)