/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_interrepository/test_fetch.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:
32
32
from breezy.bzr.vf_search import (
33
33
    SearchResult,
34
34
    )
 
35
from breezy.repository import WriteGroup
35
36
from breezy.revision import (
36
37
    NULL_REVISION,
37
38
    Revision,
110
111
        source = tree.branch.repository
111
112
        source.lock_write()
112
113
        self.addCleanup(source.unlock)
113
 
        source.start_write_group()
114
 
        try:
 
114
        with WriteGroup(source):
115
115
            # We need two revisions: OLD and NEW. NEW will claim to need a file
116
116
            # 'FOO' changed in 'OLD'. OLD will not have that file at all.
117
117
            source.texts.insert_record_stream([
133
133
                           revision_id=b'new',
134
134
                           parent_ids=[revid])
135
135
            source.add_revision(rev.revision_id, rev)
136
 
        except:
137
 
            source.abort_write_group()
138
 
            raise
139
 
        else:
140
 
            source.commit_write_group()
141
136
        to_repo.fetch(source, b'new')
142
137
        to_repo.lock_read()
143
138
        self.addCleanup(to_repo.unlock)
448
443
        # We build a broken revision so that we can test the fetch code dies
449
444
        # properly. So copy the inventory and revision, but not the text.
450
445
        with to_repo.lock_write():
451
 
            to_repo.start_write_group()
452
 
            try:
 
446
            with WriteGroup(to_repo, suppress_errors=True):
453
447
                inv = tree.branch.repository.get_inventory(rev1)
454
448
                to_repo.add_inventory(rev1, inv, [])
455
449
                rev = tree.branch.repository.get_revision(rev1)
456
450
                to_repo.add_revision(rev1, rev, inv=inv)
457
451
                self.disable_commit_write_group_paranoia(to_repo)
458
 
                to_repo.commit_write_group()
459
 
            except:
460
 
                to_repo.abort_write_group(suppress_errors=True)
461
 
                raise
462
452
 
463
453
        # Implementations can either ensure that the target of the delta is
464
454
        # reconstructable, or raise an exception (which stream based copies