/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_commit.py

  • Committer: Aaron Bentley
  • Date: 2007-06-28 16:50:06 UTC
  • mfrom: (2561 +trunk)
  • mto: (2520.4.116 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2572.
  • Revision ID: abentley@panoramicfeedback.com-20070628165006-m7bd56ngqs26rd91
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    def update(self, message, count=None, total=None):
61
61
        """See progress.ProgressBar.update()."""
62
62
        if self.depth == 1:
63
 
            self._calls.append(("update", count, total))
 
63
            self._calls.append(("update", count, total, message))
64
64
 
65
65
 
66
66
class TestCapturingUI(TestCase):
75
75
        pb2.update('foo', 0, 1)
76
76
        pb2.finished()
77
77
        pb1.finished()
78
 
        self.assertEqual([("update", 0, 1)], factory._calls)
 
78
        self.assertEqual([("update", 0, 1, 'foo')], factory._calls)
79
79
 
80
80
 
81
81
class TestCommit(TestCaseWithWorkingTree):
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 
351
350
        # committed.
352
351
        self.assertEqual(
353
 
            [("update", 0, 9),
354
 
             ("update", 1, 9),
355
 
             ("update", 2, 9),
356
 
             ("update", 3, 9),
357
 
             ("update", 4, 9),
358
 
             ("update", 5, 9),
359
 
             ("update", 6, 9),
360
 
             ("update", 7, 9)],
 
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')],
 
360
            factory._calls
 
361
           )
 
362
 
 
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 
 
366
        # emitted
 
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):
 
372
            pass
 
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')
 
376
        self.assertEqual(
 
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'),
 
383
             ],
361
384
            factory._calls
362
385
           )