~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for the Repository facility that are not interface tests.
18
18
 
929
929
        tree.lock_read()
930
930
        self.addCleanup(tree.unlock)
931
931
        packs = tree.branch.repository._pack_collection
932
 
        packs.reset()
933
932
        packs.ensure_loaded()
934
933
        name = packs.names()[0]
935
934
        pack_1 = packs.get_pack_by_name(name)
1121
1120
        self.assertTrue(new_pack.inventory_index._optimize_for_size)
1122
1121
        self.assertTrue(new_pack.text_index._optimize_for_size)
1123
1122
        self.assertTrue(new_pack.signature_index._optimize_for_size)
 
1123
 
 
1124
 
 
1125
class TestInterDifferingSerializer(TestCaseWithTransport):
 
1126
 
 
1127
    def test_progress_bar(self):
 
1128
        tree = self.make_branch_and_tree('tree')
 
1129
        tree.commit('rev1', rev_id='rev-1')
 
1130
        tree.commit('rev2', rev_id='rev-2')
 
1131
        tree.commit('rev3', rev_id='rev-3')
 
1132
        repo = self.make_repository('repo')
 
1133
        inter_repo = repository.InterDifferingSerializer(
 
1134
            tree.branch.repository, repo)
 
1135
        pb = progress.InstrumentedProgress(to_file=StringIO())
 
1136
        pb.never_throttle = True
 
1137
        inter_repo.fetch('rev-1', pb)
 
1138
        self.assertEqual('Transferring revisions', pb.last_msg)
 
1139
        self.assertEqual(1, pb.last_cnt)
 
1140
        self.assertEqual(1, pb.last_total)
 
1141
        inter_repo.fetch('rev-3', pb)
 
1142
        self.assertEqual(2, pb.last_cnt)
 
1143
        self.assertEqual(2, pb.last_total)