~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
"""
24
24
 
25
25
from stat import S_ISDIR
 
26
from StringIO import StringIO
26
27
import sys
27
28
 
28
29
import bzrlib
29
 
from bzrlib.errors import (NoSuchFile,
 
30
from bzrlib.errors import (NotBranchError,
 
31
                           NoSuchFile,
30
32
                           UnknownFormatError,
31
33
                           UnsupportedFormatError,
32
34
                           )
33
35
from bzrlib import (
34
 
    btree_index,
35
36
    graph,
36
37
    tests,
37
38
    )
 
39
from bzrlib.branchbuilder import BranchBuilder
38
40
from bzrlib.btree_index import BTreeBuilder, BTreeGraphIndex
39
 
from bzrlib.index import GraphIndex
 
41
from bzrlib.index import GraphIndex, InMemoryGraphIndex
40
42
from bzrlib.repository import RepositoryFormat
 
43
from bzrlib.smart import server
41
44
from bzrlib.tests import (
42
45
    TestCase,
43
46
    TestCaseWithTransport,
 
47
    TestSkipped,
 
48
    test_knit,
44
49
    )
45
50
from bzrlib.transport import (
 
51
    fakenfs,
46
52
    get_transport,
47
53
    )
 
54
from bzrlib.transport.memory import MemoryServer
48
55
from bzrlib import (
 
56
    bencode,
49
57
    bzrdir,
50
58
    errors,
51
59
    inventory,
52
60
    osutils,
 
61
    progress,
53
62
    repository,
54
63
    revision as _mod_revision,
 
64
    symbol_versioning,
55
65
    upgrade,
56
66
    versionedfile,
57
67
    workingtree,
455
465
        repo = self.make_repository('.',
456
466
                format=bzrdir.format_registry.get('knit')())
457
467
        inv_xml = '<inventory format="5">\n</inventory>\n'
458
 
        inv = repo._deserialise_inventory('test-rev-id', inv_xml)
 
468
        inv = repo.deserialise_inventory('test-rev-id', inv_xml)
459
469
        self.assertEqual('test-rev-id', inv.root.revision)
460
470
 
461
471
    def test_deserialise_uses_global_revision_id(self):
467
477
        # Arguably, the deserialise_inventory should detect a mismatch, and
468
478
        # raise an error, rather than silently using one revision_id over the
469
479
        # other.
470
 
        self.assertRaises(AssertionError, repo._deserialise_inventory,
 
480
        self.assertRaises(AssertionError, repo.deserialise_inventory,
471
481
            'test-rev-id', inv_xml)
472
 
        inv = repo._deserialise_inventory('other-rev-id', inv_xml)
 
482
        inv = repo.deserialise_inventory('other-rev-id', inv_xml)
473
483
        self.assertEqual('other-rev-id', inv.root.revision)
474
484
 
475
485
    def test_supports_external_lookups(self):
682
692
 
683
693
class Test2a(tests.TestCaseWithMemoryTransport):
684
694
 
685
 
    def test_chk_bytes_uses_custom_btree_parser(self):
686
 
        mt = self.make_branch_and_memory_tree('test', format='2a')
687
 
        mt.lock_write()
688
 
        self.addCleanup(mt.unlock)
689
 
        mt.add([''], ['root-id'])
690
 
        mt.commit('first')
691
 
        index = mt.branch.repository.chk_bytes._index._graph_index._indices[0]
692
 
        self.assertEqual(btree_index._gcchk_factory, index._leaf_factory)
693
 
        # It should also work if we re-open the repo
694
 
        repo = mt.branch.repository.bzrdir.open_repository()
695
 
        repo.lock_read()
696
 
        self.addCleanup(repo.unlock)
697
 
        index = repo.chk_bytes._index._graph_index._indices[0]
698
 
        self.assertEqual(btree_index._gcchk_factory, index._leaf_factory)
699
 
 
700
695
    def test_fetch_combines_groups(self):
701
696
        builder = self.make_branch_builder('source', format='2a')
702
697
        builder.start_series()