~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_fetch.py

resolve conflicts against trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    bzrdir,
21
21
    errors,
22
22
    gpg,
23
 
    graph,
24
23
    remote,
25
24
    repository,
26
25
    tests,
27
26
    )
28
27
from bzrlib.inventory import ROOT_ID
29
 
from bzrlib.tests import TestSkipped
 
28
from bzrlib.tests import (
 
29
    TestNotApplicable,
 
30
    TestSkipped,
 
31
    )
30
32
from bzrlib.tests.per_repository import TestCaseWithRepository
31
33
 
32
34
 
135
137
        repo.lock_write()
136
138
        self.addCleanup(repo.unlock)
137
139
        repo.fetch(source.repository)
 
140
        graph = repo.get_file_graph()
138
141
        self.assertEqual(result,
139
 
            repo.texts.get_parent_map([(root_id, 'tip')])[(root_id, 'tip')])
 
142
            graph.get_parent_map([(root_id, 'tip')])[(root_id, 'tip')])
140
143
 
141
144
    def test_fetch_to_rich_root_set_parent_no_parents(self):
142
145
        # No parents rev -> No parents
263
266
        repo = wt.branch.repository
264
267
        repo.lock_write()
265
268
        repo.start_write_group()
266
 
        repo.sign_revision('rev1', gpg.LoopbackGPGStrategy(None))
 
269
        try:
 
270
            repo.sign_revision('rev1', gpg.LoopbackGPGStrategy(None))
 
271
        except errors.UnsupportedOperation:
 
272
            self.assertFalse(repo._format.supports_revision_signatures)
 
273
            raise TestNotApplicable("repository format does not support signatures")
267
274
        repo.commit_write_group()
268
275
        repo.unlock()
269
276
        return repo
349
356
        self.addCleanup(source.unlock)
350
357
        target.fetch(source, revision_id='B-id')
351
358
 
352
 
 
353
 
class TestSource(TestCaseWithRepository):
354
 
    """Tests for/about the results of Repository._get_source."""
355
 
 
356
 
    def test_no_absent_records_in_stream_with_ghosts(self):
357
 
        # XXX: Arguably should be in per_interrepository but
358
 
        # doesn't actually gain coverage there; need a specific set of
359
 
        # permutations to cover it.
360
 
        # bug lp:376255 was reported about this.
361
 
        builder = self.make_branch_builder('repo')
362
 
        builder.start_series()
363
 
        builder.build_snapshot('tip', ['ghost'],
364
 
            [('add', ('', 'ROOT_ID', 'directory', ''))],
365
 
            allow_leftmost_as_ghost=True)
366
 
        builder.finish_series()
367
 
        b = builder.get_branch()
368
 
        b.lock_read()
369
 
        self.addCleanup(b.unlock)
370
 
        repo = b.repository
371
 
        source = repo._get_source(repo._format)
372
 
        search = graph.PendingAncestryResult(['tip'], repo)
373
 
        stream = source.get_stream(search)
374
 
        for substream_type, substream in stream:
375
 
            for record in substream:
376
 
                self.assertNotEqual('absent', record.storage_kind,
377
 
                    "Absent record for %s" % (((substream_type,) + record.key),))