~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_interrepository/test_interrepository.py

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006-2009, 2011 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
19
19
import sys
20
20
 
21
21
import bzrlib
22
 
import bzrlib.bzrdir as bzrdir
23
 
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
24
22
import bzrlib.errors as errors
25
23
import bzrlib.gpg
26
24
from bzrlib.inventory import Inventory
27
 
import bzrlib.repofmt.weaverepo as weaverepo
28
 
import bzrlib.repository as repository
29
 
from bzrlib.revision import NULL_REVISION, Revision
 
25
from bzrlib.revision import NULL_REVISION
30
26
from bzrlib.tests import (
31
 
    TestCase,
32
 
    TestCaseWithTransport,
33
27
    TestNotApplicable,
34
28
    TestSkipped,
35
29
    )
64
58
 
65
59
 
66
60
def check_repo_format_for_funky_id_on_win32(repo):
67
 
    if (isinstance(repo, (weaverepo.AllInOneRepository,
68
 
                          weaverepo.WeaveMetaDirRepository))
69
 
        and sys.platform == 'win32'):
70
 
            raise TestSkipped("funky chars does not permitted"
71
 
                              " on this platform in repository"
72
 
                              " %s" % repo.__class__.__name__)
 
61
    if not repo._format.supports_funky_characters and sys.platform == 'win32':
 
62
        raise TestSkipped("funky chars not allowed on this platform in repository"
 
63
                          " %s" % repo.__class__.__name__)
73
64
 
74
65
 
75
66
class TestInterRepository(TestCaseWithInterRepository):
110
101
        # and sign 'rev2'
111
102
        tree_a.branch.repository.lock_write()
112
103
        tree_a.branch.repository.start_write_group()
113
 
        tree_a.branch.repository.sign_revision('rev2', bzrlib.gpg.LoopbackGPGStrategy(None))
 
104
        tree_a.branch.repository.sign_revision('rev2',
 
105
            bzrlib.gpg.LoopbackGPGStrategy(None))
114
106
        tree_a.branch.repository.commit_write_group()
115
107
        tree_a.branch.repository.unlock()
116
108
 
139
131
        self.assertFalse(repo_b.has_revision('pizza'))
140
132
        # Asking specifically for an absent revision errors.
141
133
        self.assertRaises(errors.NoSuchRevision,
142
 
            repo_b.search_missing_revision_ids, repo_a, revision_id='pizza',
 
134
            repo_b.search_missing_revision_ids, repo_a, revision_ids=['pizza'],
143
135
            find_ghosts=True)
144
136
        self.assertRaises(errors.NoSuchRevision,
 
137
            repo_b.search_missing_revision_ids, repo_a, revision_ids=['pizza'],
 
138
            find_ghosts=False)
 
139
        self.callDeprecated(
 
140
            ['search_missing_revision_ids(revision_id=...) was deprecated in '
 
141
             '2.4.  Use revision_ids=[...] instead.'],
 
142
            self.assertRaises, errors.NoSuchRevision,
145
143
            repo_b.search_missing_revision_ids, repo_a, revision_id='pizza',
146
144
            find_ghosts=False)
147
145
 
151
149
        # make a repository to compare against that is empty
152
150
        repo_b = self.make_to_repository('empty')
153
151
        repo_a = self.bzrdir.open_repository()
154
 
        result = repo_b.search_missing_revision_ids(repo_a, revision_id='rev1')
 
152
        result = repo_b.search_missing_revision_ids(
 
153
            repo_a, revision_ids=['rev1'])
155
154
        self.assertEqual(set(['rev1']), result.get_keys())
156
155
        self.assertEqual(('search', set(['rev1']), set([NULL_REVISION]), 1),
157
156
            result.get_recipe())