/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/test_commit_builder.py

  • Committer: Jelmer Vernooij
  • Date: 2020-06-09 16:07:27 UTC
  • mto: (7490.40.36 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200609160727-08115oj4wjhugs16
Use surrogateescape in revprops.

Show diffs side-by-side

added added

removed removed

Lines of Context:
808
808
                          branch, [], branch.get_config_stack(),
809
809
                          revprops={'invalid': u'property\rwith\r\ninvalid chars'})
810
810
 
 
811
    def test_get_commit_builder_with_surrogateescape(self):
 
812
        tree = self.make_branch_and_tree(".")
 
813
        with tree.lock_write():
 
814
            builder = tree.branch.get_commit_builder([], revprops={
 
815
                'invalid': u'property' + b'\xc0'.decode('utf-8', 'surrogateescape')})
 
816
            list(builder.record_iter_changes(tree, tree.last_revision(),
 
817
                                             tree.iter_changes(tree.basis_tree())))
 
818
            builder.finish_inventory()
 
819
            try:
 
820
                rev_id = builder.commit('foo bar blah')
 
821
            except NotImplementedError:
 
822
                raise tests.TestNotApplicable(
 
823
                    'Format does not support revision properties')
 
824
        rev = tree.branch.repository.get_revision(rev_id)
 
825
        self.assertEqual('foo bar blah', rev.message)
 
826
 
811
827
    def test_commit_builder_commit_with_invalid_message(self):
812
828
        branch = self.make_branch('.')
813
829
        branch.repository.lock_write()