[MERGE][Take Five] Show the diff in the commit messages
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Jul 25 23:51:45 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Goffredo Baroncelli wrote:
> On Monday 23 July 2007, you (Aaron Bentley) wrote:
>> If you pass an encoding into make_commit_message_template, you can turn
>> the status output into the correct encoding. You can also pass the
>> encoding into show_diff trees, so that it can emit the paths in the
>> desired encoding.
>
> Hi All,
>
> === modified file 'bzrlib/diff.py'
> --- bzrlib/diff.py 2007-04-11 22:05:16 +0000
> +++ bzrlib/diff.py 2007-07-25 21:25:08 +0000
> @@ -378,7 +378,8 @@
> def show_diff_trees(old_tree, new_tree, to_file, specific_files=None,
> external_diff_options=None,
> old_label='a/', new_label='b/',
> - extra_trees=None):
> + extra_trees=None,
> + path_encoding=None):
> """Show in text form the changes from one tree to another.
>
> to_files
> @@ -389,7 +390,12 @@
>
> extra_trees
> If set, more Trees to use for looking up file ids
> +
> + path_encoding
> + If set, the path will be encoded as specified
> """
> + if path_encoding is None:
> + path_encoding = 'utf8'
^^^ It would make sense to make the parameter default to 'utf-8' instead
of None. This is safe because strings are immutable.
> @@ -436,7 +443,8 @@
> has_changes = 0
> for path, file_id, kind in delta.removed:
> has_changes = 1
> - print >>to_file, '=== removed %s %r' % (kind, path.encode('utf8'))
> + print >>to_file, '=== removed %s %r' % (kind,
> + path.encode(path_encoding))
> old_name = '%s%s\t%s' % (old_label, path,
> _patch_header_date(old_tree, file_id, path))
> new_name = '%s%s\t%s' % (new_label, path, EPOCH_DATE)
^^^ I think these should all be path.encode(path_encoding, 'replace').
We don't want commit to die if the path isn't valid in the user's encoding.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGp9QB0F+nu1YWqI0RAhoSAJ9APd84mM1lm5tOW6FHjFc4GTc3UwCdEoR8
gcGUv95sflr/OsEyeOaazzQ=
=FJR+
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list