[MERGE][Take Five] Show the diff in the commit messages
Aaron Bentley
aaron.bentley at utoronto.ca
Thu Aug 23 18:00:02 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Goffredo Baroncelli wrote:
> request; even tough I am not very happy: I think that the check is needed,
> and is the alias system too often used.
The alias system is our main way of configuring commands right now. My
experience with that has been quite positive. I wouldn't want to have a
configuration system that mostly duplicated aliases. What do you have
in mind?
bb:tweak
> @@ -2221,12 +2224,12 @@
>
> def run(self, message=None, file=None, verbose=True, selected_list=None,
> unchanged=False, strict=False, local=False, fixes=None,
> - author=None):
> + author=None, show_diff=False):
> from bzrlib.commit import (NullCommitReporter, ReportCommitToLog)
> from bzrlib.errors import (PointlessCommit, ConflictsInTree,
> StrictCommitFailed)
> - from bzrlib.msgeditor import edit_commit_message, \
> - make_commit_message_template
> + from bzrlib.msgeditor import (edit_commit_message_encoded,
> + make_commit_message_template_encoded)
When we do multiline imports, we format it like this:
from bzrlib.msgeditor import (
edit_commit_message_encoded,
make_commit_message_template_encoded,
)
> """Callback to get commit message"""
> my_message = message
> if my_message is None and not file:
> - template = make_commit_message_template(tree, selected_list)
> - my_message = edit_commit_message(template)
> + t = make_commit_message_template_encoded(tree,
> + selected_list,
> + diff=show_diff,
> + output_encoding=
> + bzrlib.user_encoding)
^^^ The indenting's wrong here.
> @@ -405,7 +411,8 @@
> has_changes = 0
> for path, file_id, kind in delta.removed:
> has_changes = 1
> - print >>to_file, "=== removed %s '%s'" % (kind, path.encode('utf8'))
> + path_ = path.encode(path_encoding, "replace")
^^^ We prefer more descriptive names, e.g. encoded_path
> +def make_commit_message_template_encoded(working_tree, specific_files,
> + diff=None, output_encoding=None):
> + """Prepare a template file for a commit into a branch.
> +
> + Returns an encoded string.
> + """
> + # TODO: make provision for this to be overridden or modified by a hook
> + #
> + # TODO: Rather than running the status command, should prepare a draft of
> + # the revision to be committed, then pause and ask the user to
> + # confirm/write a message.
> + from StringIO import StringIO # must be unicode-safe
> + from bzrlib.diff import show_diff_trees
> +
> + if output_encoding is None:
> + output_encoding = 'utf-8'
^^^ It is nicer to make 'utf-8' the default parameter, instead of None.
(unless you need to distinguish between a caller-supplied 'utf-8' and
the default 'utf-8')
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGzb0S0F+nu1YWqI0RApxpAJ9E34obEmLtiS5I47x7iijUpsz6ngCfXYzM
h/1xkS1IP+3cVJdxYjfOsvw=
=uA9O
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list