/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: Martin Pool
  • Date: 2007-09-14 06:31:28 UTC
  • mfrom: (2822 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2823.
  • Revision ID: mbp@sourcefrog.net-20070914063128-0p7mh6zfb4pzdg9p
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
271
271
        tree.lock_read()
272
272
        self.addCleanup(tree.unlock)
273
273
        # the deepest subtree has not changed, so no commit should take place.
274
 
        self.assertEqual(None, subsubtree.last_revision())
 
274
        self.assertEqual('null:', subsubtree.last_revision())
275
275
        # the intermediate tree should have committed a pointer to the current
276
276
        # subtree revision.
277
277
        sub_basis = subtree.basis_tree()
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 5 times, once per file
358
 
        # 2 files don't trigger an update, as 'a' and 'c' are not 
359
 
        # committed.
 
357
        # 5 steps, the first of which is reported 2 times, once per dir
360
358
        self.assertEqual(
361
 
            [('update', 1, 4, 'Collecting changes [Entry 0/?] - Stage'),
362
 
             ('update', 1, 4, 'Collecting changes [Entry 1/4] - Stage'),
363
 
             ('update', 1, 4, 'Collecting changes [Entry 2/4] - Stage'),
364
 
             ('update', 1, 4, 'Collecting changes [Entry 3/4] - Stage'),
365
 
             ('update', 1, 4, 'Collecting changes [Entry 4/4] - Stage'),
366
 
             ('update', 2, 4, 'Saving data locally - Stage'),
367
 
             ('update', 3, 4, 'Updating the working tree - Stage'),
368
 
             ('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')],
369
365
            factory._calls
370
366
           )
371
367
 
372
 
    def test_commit_progress_shows_hook_names(self):
 
368
    def test_commit_progress_shows_post_hook_names(self):
373
369
        tree = self.make_branch_and_tree('.')
374
370
        # set a progress bar that captures the calls so we can see what is 
375
371
        # emitted
383
379
        branch.Branch.hooks.name_hook(a_hook, 'hook name')
384
380
        tree.commit('first post')
385
381
        self.assertEqual(
386
 
            [('update', 1, 4, 'Collecting changes [Entry 0/?] - Stage'),
387
 
             ('update', 1, 4, 'Collecting changes [Entry 1/1] - Stage'),
388
 
             ('update', 2, 4, 'Saving data locally - Stage'),
389
 
             ('update', 3, 4, 'Updating the working tree - Stage'),
390
 
             ('update', 4, 4, 'Running post commit hooks - Stage'),
391
 
             ('update', 4, 4, 'Running post commit hooks [hook name] - Stage'),
392
 
             ],
393
 
            factory._calls
394
 
           )
395
 
 
396
 
 
397
 
 
 
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'),
 
389
             ],
 
390
            factory._calls
 
391
           )
 
392
 
 
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 
 
396
        # emitted
 
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):
 
402
            pass
 
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')
 
406
        self.assertEqual(
 
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'),
 
414
             ],
 
415
            factory._calls
 
416
           )