354
354
# into the factory for this test - just make the test ui factory
355
355
# pun as a reporter. Then we can check the ordering is right.
356
356
tree.commit('second post', specific_files=['b'])
357
# 4 steps, the first of which is reported 2 times, once per dir
357
# 5 steps, the first of which is reported 2 times, once per dir
358
358
self.assertEqual(
359
[('update', 1, 4, 'Collecting changes [Directory 0] - Stage'),
360
('update', 1, 4, 'Collecting changes [Directory 1] - Stage'),
361
('update', 2, 4, 'Saving data locally - Stage'),
362
('update', 3, 4, 'Updating the working tree - Stage'),
363
('update', 4, 4, 'Running post commit hooks - Stage')],
359
[('update', 1, 5, 'Collecting changes [Directory 0] - Stage'),
360
('update', 1, 5, 'Collecting changes [Directory 1] - Stage'),
361
('update', 2, 5, 'Saving data locally - Stage'),
362
('update', 3, 5, 'Running pre commit hooks - Stage'),
363
('update', 4, 5, 'Updating the working tree - Stage'),
364
('update', 5, 5, 'Running post commit hooks - Stage')],
367
def test_commit_progress_shows_hook_names(self):
368
def test_commit_progress_shows_post_hook_names(self):
368
369
tree = self.make_branch_and_tree('.')
369
370
# set a progress bar that captures the calls so we can see what is
378
379
branch.Branch.hooks.name_hook(a_hook, 'hook name')
379
380
tree.commit('first post')
380
381
self.assertEqual(
381
[('update', 1, 4, 'Collecting changes [Directory 0] - Stage'),
382
('update', 1, 4, 'Collecting changes [Directory 1] - Stage'),
383
('update', 2, 4, 'Saving data locally - Stage'),
384
('update', 3, 4, 'Updating the working tree - Stage'),
385
('update', 4, 4, 'Running post commit hooks - Stage'),
386
('update', 4, 4, 'Running post commit hooks [hook name] - Stage'),
382
[('update', 1, 5, 'Collecting changes [Directory 0] - Stage'),
383
('update', 1, 5, 'Collecting changes [Directory 1] - Stage'),
384
('update', 2, 5, 'Saving data locally - Stage'),
385
('update', 3, 5, 'Running pre commit hooks - Stage'),
386
('update', 4, 5, 'Updating the working tree - Stage'),
387
('update', 5, 5, 'Running post commit hooks - Stage'),
388
('update', 5, 5, 'Running post commit hooks [hook name] - Stage'),
393
def test_commit_progress_shows_pre_hook_names(self):
394
tree = self.make_branch_and_tree('.')
395
# set a progress bar that captures the calls so we can see what is
397
self.old_ui_factory = ui.ui_factory
398
self.addCleanup(self.restoreDefaults)
399
factory = CapturingUIFactory()
400
ui.ui_factory = factory
401
def a_hook(_, _2, _3, _4, _5, _6, _7, _8, _9):
403
branch.Branch.hooks.install_hook('pre_commit', a_hook)
404
branch.Branch.hooks.name_hook(a_hook, 'hook name')
405
tree.commit('first post')
407
[('update', 1, 5, 'Collecting changes [Directory 0] - Stage'),
408
('update', 1, 5, 'Collecting changes [Directory 1] - Stage'),
409
('update', 2, 5, 'Saving data locally - Stage'),
410
('update', 3, 5, 'Running pre commit hooks - Stage'),
411
('update', 3, 5, 'Running pre commit hooks [hook name] - Stage'),
412
('update', 4, 5, 'Updating the working tree - Stage'),
413
('update', 5, 5, 'Running post commit hooks - Stage'),