198
197
'trivial_custom_prop_handler',
199
198
trivial_custom_prop_handler)
200
199
log = self.run_bzr("log --limit 1")[0]
201
# check if it's in the output
202
200
self.assertContainsRe(log, r'first_prop: first_value\n')
204
log = self.run_bzr("log -r1")[0]
205
# should no be any extra properties in the first revision
206
self.assertNotContainsRe(log, r'first_prop: first_value\n')
201
log = self.run_bzr("log -r1")[0]
202
self.assertNotContainsRe(log, r'first_prop: first_value\n')
203
bzrlib.log.custom_properties_handler_registry.remove(
204
'trivial_custom_prop_handler')
206
def test_log_without_custom_properties_handler(self):
207
tree = self._prepare()
208
tree.commit(message='', revprops={'first_prop':'first_value'})
209
log = self.run_bzr("log --limit 1")[0]
210
self.assertNotContainsRe(log, r'first_prop: first_value\n')
211
log = self.run_bzr("log -r1")[0]
212
self.assertNotContainsRe(log, r'first_prop: first_value\n')
214
def test_log_broken_custom_properties_handler(self):
215
tree = self._prepare()
216
tree.commit(message='', revprops={'first_prop':'first_value'})
218
# define a broken custom property handler
219
def broken_custom_prop_handler(props_dict):
220
raise errors.BzrError('a test error')
222
bzrlib.log.custom_properties_handler_registry.register(
223
'broken_custom_prop_handler',
224
broken_custom_prop_handler)
225
log = self.run_bzr("log --limit 1")[0]
226
self.assertNotContainsRe(log, r'first_prop: first_value\n')
227
log = self.run_bzr("log -r1")[0]
228
self.assertNotContainsRe(log, r'first_prop: first_value\n')
229
bzr_log = self._get_log(keep_log_file=True)
230
self.assertContainsRe(bzr_log,
231
"custom property handler: %s raised an error" % \
232
'broken_custom_prop_handler')
233
self.assertContainsRe(bzr_log, 'a test error')
234
bzrlib.log.custom_properties_handler_registry.remove(
235
'broken_custom_prop_handler')
208
238
class TestLogMerges(ExternalBase):