~bzr-pqm/bzr/bzr.dev

2604.2.1 by Robert Collins
(robertc) Introduce a pack command.
1
# Copyright (C) 2007 Canonical Ltd
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2604.2.1 by Robert Collins
(robertc) Introduce a pack command.
16
17
"""Tests for repository packing."""
18
3689.1.1 by John Arbash Meinel
Rename repository_implementations tests into per_repository tests
19
from bzrlib.tests.per_repository import TestCaseWithRepository
2604.2.1 by Robert Collins
(robertc) Introduce a pack command.
20
21
22
class TestPack(TestCaseWithRepository):
23
24
    def test_pack_empty_does_not_error(self):
25
        repo = self.make_repository('.')
26
        repo.pack()
4431.3.7 by Jonathan Lange
Cherrypick bzr.dev 4470, resolving conflicts.
27
28
    def test_pack_accepts_opaque_hint(self):
29
        # For requesting packs of a repository where some data is known to be
30
        # unoptimal we permit packing just some data via a hint. If the hint is
31
        # illegible it is ignored.
32
        tree = self.make_branch_and_tree('tree')
33
        rev1 = tree.commit('1')
34
        rev2 = tree.commit('2')
35
        rev3 = tree.commit('3')
36
        rev4 = tree.commit('4')
37
        tree.branch.repository.pack(hint=[rev3, rev4])