[MERGE] Defer prompting for commit message until commit is mostly done [was: Fix commit --strict regression]

John Arbash Meinel john at arbash-meinel.com
Tue Nov 28 16:43:52 GMT 2006


Aaron Bentley wrote:

...

>>> and that way we can put the onus on decoding etc to the supplier of
>>> the callback, and change the logic for upcasting the message parameter
>>> to use 'osutils.safe_unicode'.
> 
> I'm not sure what you're saying.
> 
> I would be happy with "callback must return unicode".  But
> osutils.safe_unicode also does conversion from utf-8 to unicode.  So
> this would suggest that the callback may return utf-8 as well as unicode.

I think "callback must return unicode" is the best policy. Because at
that point, we have gotten past user encoding, and we are in the
internals. MutableTree.commit() can handle if the message is in ascii.
And builtins.py will pass in a function which can also handle user
encoding. So I think you did the right thing.

> So I propose avoiding the safe_unicode, and just asserting that the
> commit callback result is unicode, which means the rules are:
> 1. callback must return unicode
> 2. message must be unicode or user_encoding.
> 
> Aaron

Agreed.


...

v- Earlier you said you were passing the CommitBuilder as the parameter,
but here you are passing the Commit() object.

I don't really know which is best, but if you want to pass CommitBuilder
this needs to be:

  message = message_callback(self.builder)

And we should probably have a test either way, to make sure we don't
accidentally change the api in the future.

+            message = message_callback(self)
+            assert isinstance(message, unicode), type(message)
+            self.message = message
+            self._escape_commit_message()
+
             self.rev_id = self.builder.commit(self.message)
             self._emit_progress_update()
             # revision data is in the local branch now.


The rest has my +1.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061128/68e0eb2a/attachment.pgp 


More information about the bazaar mailing list