/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_repository_vf/test_write_group.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:
18
18
 
19
19
import sys
20
20
 
21
 
from bzrlib import (
 
21
from breezy import (
22
22
    branch,
23
23
    controldir,
24
24
    errors,
27
27
    tests,
28
28
    versionedfile,
29
29
    )
30
 
from bzrlib.tests.per_repository_vf import (
 
30
from breezy.tests.per_repository_vf import (
31
31
    TestCaseWithRepository,
32
32
    all_repository_vf_format_scenarios,
33
33
    )
34
 
from bzrlib.tests.scenarios import load_tests_apply_scenarios
 
34
from breezy.tests.scenarios import load_tests_apply_scenarios
35
35
 
36
36
 
37
37
load_tests = load_tests_apply_scenarios
188
188
        self.assertEqual(set(),
189
189
                repo.inventories.get_missing_compression_parent_keys())
190
190
        self.assertEqual(
191
 
            set([('inventories', 'rev-1')]),
 
191
            {('inventories', 'rev-1')},
192
192
            repo.get_missing_parent_inventories())
193
193
        # Resuming the write group does not affect
194
194
        # get_missing_parent_inventories.
195
195
        reopened_repo = self.reopen_repo_and_resume_write_group(repo)
196
196
        self.assertEqual(
197
 
            set([('inventories', 'rev-1')]),
 
197
            {('inventories', 'rev-1')},
198
198
            reopened_repo.get_missing_parent_inventories())
199
199
        # Adding the parent inventory satisfies get_missing_parent_inventories.
200
200
        reopened_repo.inventories.insert_record_stream(
229
229
                          b.repository.get_inventory('A-id'))
230
230
        get_missing = repo.get_missing_parent_inventories
231
231
        if repo._format.supports_external_lookups:
232
 
            self.assertEqual(set([('inventories', 'ghost-parent-id')]),
 
232
            self.assertEqual({('inventories', 'ghost-parent-id')},
233
233
                get_missing(check_for_missing_texts=False))
234
234
            self.assertEqual(set(), get_missing(check_for_missing_texts=True))
235
235
            self.assertEqual(set(), get_missing())
392
392
        try:
393
393
            new_wg_tokens = same_repo.suspend_write_group()
394
394
        except:
395
 
            e = sys.exc_info()
396
395
            same_repo.abort_write_group(suppress_errors=True)
397
 
            raise e[0], e[1], e[2]
 
396
            raise
398
397
        self.assertEqual(2, len(new_wg_tokens))
399
398
        self.assertSubset(wg_tokens, new_wg_tokens)
400
399
        same_repo = self.reopen_repo(repo)
401
400
        same_repo.resume_write_group(new_wg_tokens)
402
 
        both_keys = set([first_key, second_key])
 
401
        both_keys = {first_key, second_key}
403
402
        self.assertEqual(both_keys, same_repo.texts.keys())
404
403
        same_repo.abort_write_group()
405
404
 
519
518
        same_repo.texts.add_lines(second_key, (first_key,), ['more lines'])
520
519
        same_repo.commit_write_group()
521
520
        self.assertEqual(
522
 
            set([first_key, second_key]), set(same_repo.texts.keys()))
 
521
            {first_key, second_key}, set(same_repo.texts.keys()))
523
522
        self.assertEqual(
524
523
            'lines', same_repo.texts.get_record_stream([first_key],
525
524
                'unordered', True).next().get_bytes_as('fulltext'))