header.py

changeset 59
0f3e70a2bb4b
parent 56
ed6d39c59e56
child 60
b8fac2477fc8
equal deleted inserted replaced
58:86014c443635 59:0f3e70a2bb4b
123 'bfc'): 123 'bfc'):
124 result.bfc = self.groups[0] 124 result.bfc = self.groups[0]
125 elif self.try_to_match( 125 elif self.try_to_match(
126 r'!HISTORY (\d{4}-\d{2}-\d{2}) ([\[{][^\]}]+[\]}]) (.+)$', 126 r'!HISTORY (\d{4}-\d{2}-\d{2}) ([\[{][^\]}]+[\]}]) (.+)$',
127 'history'): 127 'history'):
128 try:
129 time_object = datetime.datetime.strptime(
130 self.groups[0],
131 '%Y-%m-%d',
132 )
133 except ValueError:
134 self.parse_error("invalid ISO date in history")
128 result.history.append(HistoryEntry( 135 result.history.append(HistoryEntry(
129 date = datetime.datetime.strptime(self.groups[0], '%Y-%m-%d').date(), 136 date = time_object.date(),
130 user = self.groups[1], 137 user = self.groups[1],
131 text = self.groups[2], 138 text = self.groups[2],
132 )) 139 ))
133 elif self.try_to_match( 140 elif self.try_to_match(
134 r'!HELP (.+)', 141 r'!HELP (.+)',

mercurial