/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_repository_vf/helpers.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    osutils,
21
21
    revision as _mod_revision,
22
22
    )
 
23
from ...repository import WriteGroup
23
24
from ...bzr import (
24
25
    inventory,
25
26
    )
50
51
                "%s isn't a knit format" % self.repository_format)
51
52
 
52
53
        repo = self.make_repository('broken')
53
 
        repo.lock_write()
54
 
        repo.start_write_group()
55
 
        try:
 
54
        with repo.lock_write(), WriteGroup(repo):
56
55
            inv = inventory.Inventory(revision_id=b'revision-id')
57
56
            inv.root.revision = b'revision-id'
58
57
            inv_sha1 = repo.add_inventory(b'revision-id', inv, [])
66
65
            # Manually add the revision text using the RevisionStore API, with
67
66
            # bad parents.
68
67
            rev_text = repo._serializer.write_revision_to_string(revision)
69
 
            repo.revisions.add_lines((revision.revision_id,),
70
 
                                     [(b'incorrect-parent',)],
71
 
                                     osutils.split_lines(rev_text))
72
 
        except:
73
 
            repo.abort_write_group()
74
 
            repo.unlock()
75
 
            raise
76
 
        else:
77
 
            repo.commit_write_group()
78
 
            repo.unlock()
 
68
            repo.revisions.add_lines(
 
69
                (revision.revision_id,), [(b'incorrect-parent',)],
 
70
                osutils.split_lines(rev_text))
79
71
 
80
72
        repo.lock_write()
81
73
        self.addCleanup(repo.unlock)