def _update_history(self):
version = self.data['<STR_LIT>']<EOL>history = self.vcs.history_file()<EOL>if not history:<EOL><INDENT>logger.warn("<STR_LIT>")<EOL>return<EOL><DEDENT>history_lines = open(history).read().split('<STR_LIT:\n>')<EOL>headings = utils.extract_headings_from_history(history_lines)<EOL>if not len(headings):<EOL><INDENT>logger.warn("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>inject_location = <NUM_LIT:0><EOL>underline_char = '<STR_LIT:->'<EOL><DEDENT>else:<EOL><INDENT>first = headings[<NUM_LIT:0>]<EOL>inject_location = first['<STR_LIT>']<EOL>underline_line = first['<STR_LIT>'] + <NUM_LIT:1><EOL>try:<EOL><INDENT>underline_char = history_lines[underline_line][<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>underline_char = '<STR_LIT:->'<EOL><DEDENT><DEDENT>header = '<STR_LIT>' % version<EOL>inject = [header,<EOL>underline_char * len(header),<EOL>'<STR_LIT>',<EOL>self.data['<STR_LIT>'],<EOL>'<STR_LIT>',<EOL>'<STR_LIT>']<EOL>history_lines[inject_location:inject_location] = inject<EOL>contents = '<STR_LIT:\n>'.join(history_lines)<EOL>open(history, '<STR_LIT:w>').write(contents)<EOL>logger.info("<STR_LIT>", header)<EOL>
Update the history file