217 newhashes = tuple(node.bin(hash) for hash in newhashes.split(',')) |
218 newhashes = tuple(node.bin(hash) for hash in newhashes.split(',')) |
218 return cls( |
219 return cls( |
219 (timestamp, tz), user, command, namespace, name, |
220 (timestamp, tz), user, command, namespace, name, |
220 oldhashes, newhashes) |
221 oldhashes, newhashes) |
221 |
222 |
222 def __str__(self): |
223 def __bytes__(self): |
223 """String representation for storage""" |
224 """bytes representation for storage""" |
224 time = ' '.join(map(str, self.timestamp)) |
225 time = ' '.join(map(str, self.timestamp)) |
225 oldhashes = ','.join([node.hex(hash) for hash in self.oldhashes]) |
226 oldhashes = ','.join([node.hex(hash) for hash in self.oldhashes]) |
226 newhashes = ','.join([node.hex(hash) for hash in self.newhashes]) |
227 newhashes = ','.join([node.hex(hash) for hash in self.newhashes]) |
227 return '\n'.join(( |
228 return '\n'.join(( |
228 time, self.user, self.command, self.namespace, self.name, |
229 time, self.user, self.command, self.namespace, self.name, |
229 oldhashes, newhashes)) |
230 oldhashes, newhashes)) |
|
231 |
|
232 __str__ = encoding.strmethod(__bytes__) |
230 |
233 |
231 class journalstorage(object): |
234 class journalstorage(object): |
232 """Storage for journal entries |
235 """Storage for journal entries |
233 |
236 |
234 Entries are divided over two files; one with entries that pertain to the |
237 Entries are divided over two files; one with entries that pertain to the |