~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: ghigo
  • Date: 2007-07-16 17:52:07 UTC
  • mto: (2772.1.1 show-diff)
  • mto: This revision was merged to the branch mainline in revision 2773.
  • Revision ID: ghigo@venice-20070716175207-d1d8mmetgg8krcbd
On the basis of the email from Martin, Aaron I changed the encoding logic
in the function make_commit_message_template()
- in the diff, if the line is an header is decoded as UTF8
- otherwise the line is decoded as bzrlib.user_encoding
the rationale is that the message is already encoded as bzrlib.user_encoding
during the writing.
So the header which is know the encoding are correctly decoded. For the
other data, the decoding is the same of one which is used during the 
file writing in order do minimize the encoding/decoding effect.

In order to move the user encoding at the UI level, the parameter user_encoding
is added to the functions

- make_commit_message_template 
- _create_temp_file_with_commit_template
- edit_commit_message


Finally, I also added a paragraph to the tutorial about the option, and added
another while I was there (thank to James Westby)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2174
2174
            """Callback to get commit message"""
2175
2175
            my_message = message
2176
2176
            if my_message is None and not file:
2177
 
                template = make_commit_message_template(tree, selected_list, diff)
2178
 
                my_message = edit_commit_message(template)
 
2177
                template = make_commit_message_template(tree, selected_list,
 
2178
                                                        diff,
 
2179
                                                        user_encoding=bzrlib.user_encoding)
 
2180
                my_message = edit_commit_message(template,
 
2181
                                                 user_encoding=bzrlib.user_encoding)
2179
2182
                if my_message is None:
2180
2183
                    raise errors.BzrCommandError("please specify a commit"
2181
2184
                        " message with either --message or --file")