~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    return multiply_tests(to_adapt, scenarios, result)
66
66
 
67
67
 
 
68
def create_texts_for_inv(repo, inv):
 
69
    for path, ie in inv.iter_entries():
 
70
        if ie.text_size:
 
71
            lines = ['a' * ie.text_size]
 
72
        else:
 
73
            lines = []
 
74
        repo.texts.add_lines((ie.file_id, ie.revision), [], lines)
 
75
    
68
76
def apply_inventory_Inventory(self, basis, delta):
69
77
    """Apply delta to basis and return the result.
70
78
    
137
145
            rev = revision.Revision('basis', timestamp=0, timezone=None,
138
146
                message="", committer="foo@example.com")
139
147
            basis.revision_id = 'basis'
 
148
            create_texts_for_inv(tree.branch.repository, basis)
140
149
            repo.add_revision('basis', rev, basis)
141
150
            # Add a revision for the result, with the basis content - 
142
151
            # update_basis_by_delta doesn't check that the delta results in
146
155
                message="", committer="foo@example.com")
147
156
            basis.revision_id = 'result'
148
157
            repo.add_revision('result', rev, basis)
 
158
            repo.commit_write_group()
149
159
        except:
150
160
            repo.abort_write_group()
151
161
            raise
152
 
        else:
153
 
            repo.commit_write_group()
154
162
        # Set the basis state as the trees current state
155
163
        tree._write_inventory(basis)
156
164
        # This reads basis from the repo and puts it into the tree's local
221
229
            rev = revision.Revision('basis', timestamp=0, timezone=None,
222
230
                message="", committer="foo@example.com")
223
231
            basis.revision_id = 'basis'
 
232
            create_texts_for_inv(repo, basis)
224
233
            repo.add_revision('basis', rev, basis)
 
234
            repo.commit_write_group()
225
235
        except:
226
236
            repo.abort_write_group()
227
237
            raise
228
 
        else:
229
 
            repo.commit_write_group()
230
238
    finally:
231
239
        repo.unlock()
232
240
    repo.lock_write()