Where does self.message get set on the Revision object?
Alexander Belchenko
bialix at ukr.net
Tue Jun 2 20:29:10 BST 2009
Jelmer Vernooij пишет:
> On Tue, Jun 02, 2009 at 12:51:31PM -0500, John Arbash Meinel wrote:
>>>> But I'll comment that this Revision object has probably not been
>>>> serialized to disk. And my bet is that it is generated from something
>>>> like bzr-svn.
>
>>> I believe I stated that initially, but yes, it's coming from bzr-svn.
>>> I ran the client directly against the Subversion repository (*the*
>>> Subversion repository), and ran into a commit that didn't have a log
>>> message. If it's bzr-svn's fault (and it sounds like you're hinting
>>> that it is), then I can look to make the change there so that it
>>> provides a default empty message. If it's truly expected that
>>> self.message can be None, get_summary() should definitely be updated,
>>> and depending on it's output, qbzr might need to be fixed to. I'm
>>> just trying to figure out where I need to focus my energy. :-)
>
>>> I'll definitely send submit a patch and a test for get_summary(). But
>>> if anyone knows the answer as to whether it's acceptable for .message
>>> to be None, I'll submit a patch to bzr-svn as well, if it's considered
>>> to be broken in that respect.
>> 1) bzrlib internals seem to always set Revision.message to the empty
>> string, rather than None
>> 2) Everything but LineLogFormatter seems to wrap a:
>> if not rev.message:
>> # say something about "no message"
>> else:
>> message = XXX
>> Which means that they handle None or '' equally.
>> 3) I don't really care whether Revision.message is None or ''. There at
>> least is an argument that bzr-svn => bzr => will end up as an empty
>> string, so arguably bzr-svn should encode that in the beginning.
>> Otherwise "SVNRevision == Revision" would fail because None != ''.
>
>> I would probably say that Revision.get_summary() should return an empty
>> string, and that LogLineFormatter should format that into "(no message)"
>> if it wants.
>
>> And thus QBzr can also format '' => (no message) or whatever other
>> string it wants to use. I prefer that to get_summary() doing the
>> formatting, because QBzr can then know if it is a truly empty message
>> and change to do something like use a grayed-out message for that
>> revision, etc. If you return "(no message)" then QBzr needs to guess
>> whether there is no message, or whether someone explictly chose to do:
>
>> bzr commit -m "(no message)"
>
> It would be nice if rev.message = None was supported.
> Subversion distinguishes between the commit message not being set at
> all and it being empty. It would be nice if the fact that the commit
> message was not set at all could be kept when importing into Bazaar
> rather than "cast" to an empty message.
>
> We should add some tests to see that the serializer deals with
> None properly, whether we decide to allow it or not.
IIUC from John analysis if there is no serialized message item, it should deserialized as None.
Does it right?
More information about the bazaar
mailing list