345
345
# into the factory for this test - just make the test ui factory
346
346
# pun as a reporter. Then we can check the ordering is right.
347
347
tree.commit('second post', specific_files=['b'])
348
# 9 steps: 1 for rev, 2 for inventory, 1 for finishing. 2 for root
349
# and 6 for inventory files.
350
# 2 steps don't trigger an update, as 'a' and 'c' are not
348
# 4 steps, the first of which is reported 5 times, once per file
349
# 2 files don't trigger an update, as 'a' and 'c' are not
352
351
self.assertEqual(
352
[('update', 1, 4, 'Collecting changes [Entry 0/?] - Stage'),
353
('update', 1, 4, 'Collecting changes [Entry 1/4] - Stage'),
354
('update', 1, 4, 'Collecting changes [Entry 2/4] - Stage'),
355
('update', 1, 4, 'Collecting changes [Entry 3/4] - Stage'),
356
('update', 1, 4, 'Collecting changes [Entry 4/4] - Stage'),
357
('update', 2, 4, 'Saving data locally - Stage'),
358
('update', 3, 4, 'Updating the working tree - Stage'),
359
('update', 4, 4, 'Running post commit hooks - Stage')],
363
def test_commit_progress_shows_hook_names(self):
364
tree = self.make_branch_and_tree('.')
365
# set a progress bar that captures the calls so we can see what is
367
self.old_ui_factory = ui.ui_factory
368
self.addCleanup(self.restoreDefaults)
369
factory = CapturingUIFactory()
370
ui.ui_factory = factory
371
def a_hook(_, _2, _3, _4, _5, _6):
373
branch.Branch.hooks.install_hook('post_commit', a_hook)
374
branch.Branch.hooks.name_hook(a_hook, 'hook name')
375
tree.commit('first post')
377
[('update', 1, 4, 'Collecting changes [Entry 0/?] - Stage'),
378
('update', 1, 4, 'Collecting changes [Entry 1/1] - Stage'),
379
('update', 2, 4, 'Saving data locally - Stage'),
380
('update', 3, 4, 'Updating the working tree - Stage'),
381
('update', 4, 4, 'Running post commit hooks - Stage'),
382
('update', 4, 4, 'Running post commit hooks [hook name] - Stage'),