/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/per_interrepository/test_fetch.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import sys
19
19
 
20
 
from bzrlib import (
 
20
from breezy import (
21
21
    errors,
22
22
    inventory,
23
23
    osutils,
24
24
    repository,
25
25
    versionedfile,
26
26
    )
27
 
from bzrlib.errors import (
 
27
from breezy.errors import (
28
28
    NoSuchRevision,
29
29
    )
30
 
from bzrlib.vf_search import (
 
30
from breezy.vf_search import (
31
31
    SearchResult,
32
32
    )
33
 
from bzrlib.revision import (
 
33
from breezy.revision import (
34
34
    NULL_REVISION,
35
35
    Revision,
36
36
    )
37
 
from bzrlib.tests import (
 
37
from breezy.tests import (
38
38
    TestNotApplicable,
39
39
    )
40
 
from bzrlib.tests.per_interrepository import (
 
40
from breezy.tests.per_interrepository import (
41
41
    TestCaseWithInterRepository,
42
42
    )
43
 
from bzrlib.tests.per_interrepository.test_interrepository import (
 
43
from breezy.tests.per_interrepository.test_interrepository import (
44
44
    check_repo_format_for_funky_id_on_win32
45
45
    )
46
46
 
169
169
        target.fetch(stacked_branch.repository, 'third')
170
170
        target.lock_read()
171
171
        self.addCleanup(target.unlock)
172
 
        all_revs = set(['first', 'second', 'third'])
 
172
        all_revs = {'first', 'second', 'third'}
173
173
        self.assertEqual(all_revs, set(target.get_parent_map(all_revs)))
174
174
 
175
175
    def test_fetch_parent_inventories_at_stacking_boundary_smart(self):
225
225
        self.assertFalse(unstacked_repo.has_revision('left'))
226
226
        self.assertFalse(unstacked_repo.has_revision('right'))
227
227
        self.assertEqual(
228
 
            set([('left',), ('right',), ('merge',)]),
 
228
            {('left',), ('right',), ('merge',)},
229
229
            unstacked_repo.inventories.keys())
230
230
        # And the basis inventories have been copied correctly
231
231
        trunk.lock_read()
247
247
        # present, and also generating a stream should succeed without blowing
248
248
        # up.
249
249
        self.assertTrue(unstacked_repo.has_revision('merge'))
250
 
        expected_texts = set([('file-id', 'merge')])
 
250
        expected_texts = {('file-id', 'merge')}
251
251
        if stacked_branch.repository.texts.get_parent_map([('root-id',
252
252
            'merge')]):
253
253
            # If a (root-id,merge) text exists, it should be in the stacked
257
257
        self.assertCanStreamRevision(unstacked_repo, 'merge')
258
258
 
259
259
    def assertCanStreamRevision(self, repo, revision_id):
260
 
        exclude_keys = set(repo.all_revision_ids()) - set([revision_id])
 
260
        exclude_keys = set(repo.all_revision_ids()) - {revision_id}
261
261
        search = SearchResult([revision_id], exclude_keys, 1, [revision_id])
262
262
        source = repo._get_source(repo._format)
263
263
        for substream_kind, substream in source.get_stream(search):
292
292
        self.assertFalse(unstacked_repo.has_revision('second'))
293
293
        self.assertFalse(unstacked_repo.has_revision('ghost'))
294
294
        self.assertEqual(
295
 
            set([('second',), ('third',)]),
 
295
            {('second',), ('third',)},
296
296
            unstacked_repo.inventories.keys())
297
297
        # And the basis inventories have been copied correctly
298
298
        trunk.lock_read()
307
307
        # present, and also generating a stream should succeed without blowing
308
308
        # up.
309
309
        self.assertTrue(unstacked_repo.has_revision('third'))
310
 
        expected_texts = set([('file-id', 'third')])
 
310
        expected_texts = {('file-id', 'third')}
311
311
        if stacked_branch.repository.texts.get_parent_map([('root-id',
312
312
            'third')]):
313
313
            # If a (root-id,third) text exists, it should be in the stacked
373
373
        self.assertFalse(new_unstacked_repo.has_revision('left'))
374
374
        self.assertFalse(new_unstacked_repo.has_revision('right'))
375
375
        self.assertEqual(
376
 
            set([('left',), ('right',), ('merge',)]),
 
376
            {('left',), ('right',), ('merge',)},
377
377
            new_unstacked_repo.inventories.keys())
378
378
        # And the basis inventories have been copied correctly
379
379
        new_trunk.lock_read()
392
392
        # present, and also generating a stream should succeed without blowing
393
393
        # up.
394
394
        self.assertTrue(new_unstacked_repo.has_revision('merge'))
395
 
        expected_texts = set([('file-id', 'merge')])
 
395
        expected_texts = {('file-id', 'merge')}
396
396
        if new_stacked_branch.repository.texts.get_parent_map([('root-id',
397
397
            'merge')]):
398
398
            # If a (root-id,merge) text exists, it should be in the stacked
434
434
        # generally do).
435
435
        try:
436
436
            to_repo.fetch(tree.branch.repository, 'rev-two')
437
 
        except (errors.BzrCheckError, errors.RevisionNotPresent), e:
 
437
        except (errors.BzrCheckError, errors.RevisionNotPresent) as e:
438
438
            # If an exception is raised, the revision should not be in the
439
439
            # target.
440
440
            #