/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_branch/test_commit.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-06 01:18:08 UTC
  • mfrom: (7143 work)
  • mto: This revision was merged to the branch mainline in revision 7151.
  • Revision ID: jelmer@jelmer.uk-20181106011808-y870f4vq0ork3ahu
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
        tree.lock_write()
151
151
        tree.add('')
152
152
        root_delta.added = [('', tree.path2id(''), 'directory')]
153
 
        class PreCommitException(Exception): pass
 
153
        class PreCommitException(Exception):
 
154
            
 
155
            def __init__(self, revid):
 
156
                self.revid = revid
154
157
        def hook_func(local, master,
155
158
                      old_revno, old_revid, new_revno, new_revid,
156
159
                      tree_delta, future_tree):
163
166
        # so the commit is rolled back and revno unchanged
164
167
        err = self.assertRaises(PreCommitException, tree.commit, 'message')
165
168
        # we have to record the revid to use in assertEqual later
166
 
        revids[0] = str(err)
 
169
        revids[0] = err.revid
167
170
        # unregister all pre_commit hooks
168
171
        branch.Branch.hooks["pre_commit"] = []
169
172
        # and re-register the capture hook
189
192
            # setting up a playground
190
193
            tree.add('rootfile')
191
194
            rootfile_id = tree.path2id('rootfile')
192
 
            tree.put_file_bytes_non_atomic('rootfile', 'abc')
 
195
            tree.put_file_bytes_non_atomic('rootfile', b'abc')
193
196
            tree.add('dir')
194
197
            dir_id = tree.path2id('dir')
195
198
            tree.add('dir/subfile')
196
199
            dir_subfile_id = tree.path2id('dir/subfile')
197
 
            tree.put_file_bytes_non_atomic('to_be_unversioned', 'blah')
 
200
            tree.put_file_bytes_non_atomic('to_be_unversioned', b'blah')
198
201
            tree.add(['to_be_unversioned'])
199
202
            to_be_unversioned_id = tree.path2id('to_be_unversioned')
200
 
            tree.put_file_bytes_non_atomic('dir/subfile', 'def')
 
203
            tree.put_file_bytes_non_atomic('dir/subfile', b'def')
201
204
            revid1 = tree.commit('first revision')
202
205
 
203
206
        with tree.lock_write():
204
207
            # making changes
205
 
            tree.put_file_bytes_non_atomic('rootfile', 'jkl')
 
208
            tree.put_file_bytes_non_atomic('rootfile', b'jkl')
206
209
            tree.rename_one('dir/subfile', 'dir/subfile_renamed')
207
210
            tree.unversion(['to_be_unversioned'])
208
211
            tree.mkdir('added_dir')