[MERGE][#172612] bzr commit: don't print the revision number twice

Matt Nordhoff mnordhoff at mattnordhoff.com
Fri Nov 30 13:36:26 GMT 2007


Alexander Belchenko wrote:
> Matt Nordhoff пишет:
>> Alexander Belchenko wrote:
>>> bb:tweak
>>>
>>> Because your patch misses 1.0 release before merging it in
>>> someone should tweak NEWS and mentioned version numbers.
>>
>> Tweak NEWS? What? Move it to a new "in development" section instead? I'd
>> be happy to do that, once that change hits bzr.dev.
> 
> Yes, please.

Well, I'm not going to add the new section...

>>> === modified file 'bzrlib/commit.py'
>>> --- bzrlib/commit.py    2007-11-27 20:35:02 +0000
>>> +++ bzrlib/commit.py    2007-11-30 02:43:40 +0000
>>> @@ -91,6 +91,10 @@
>>>      """I report on progress of a commit."""
>>>
>>>      def started(self, revno, revid, location=None):
>>> +        if location is None:
>>> +            symbol_versioning.warn("As of bzr 0.93 you must pass a
>>> location "
>>> +                                   "to started.", DeprecationWarning,
>>> +                                   stacklevel=2)
>>>          pass
>>>
>>> ^-- It's a bit strange (;-D) but our 0.93 eventually becomes 1.0, and
>>> your patch most likely will be merged to 1.1, so this warning should
>>> be updated appropriately.
>>
>> I know, but I was following symbol_versioning using zero_ninetythree.
>>
>> I almost wrote a patch once for finding "0.19" in the help.
> 
> So bzrlib need to have the way to use named constants instead of fixed
> strings for this purpose. Want to file a bug?

There's a two-year-old comment in symbol_versioning.py about a decorator
or something for deprecating args.

>>> @@ -133,10 +137,15 @@
>>>
>>>      def started(self, revno, rev_id, location=None):
>>>          if location is not None:
>>> -            location = ' to "' + unescape_for_display(location,
>>> 'utf-8') + '"'
>>> +            location = ' to: ' + unescape_for_display(location,
>>> 'utf-8')
>>>          else:
>>> +            # When started was added, location was only made
>>> optional by
>>> +            # accident.  Matt Nordhoff 20071129
>>> +            symbol_versioning.warn("As of bzr 0.93 you must pass a
>>> location "
>>> +                                   "to started.", DeprecationWarning,
>>> +                                   stacklevel=2)
>>>              location = ''
>>> -        self._note('Committing revision %d%s.', revno, location)
>>> +        self._note('Committing%s', location)
>>>
>>> ^-- I'd prefer to use:
>>> location = 'to: ' + unescape_for_display(location, 'utf-8')
>>> and then
>>> self._note('Committing %s', location)
>>>
>>> it's more readable IMO.
>>
>> But then there'd be an extra space. Also, at least it's not less
>> readable than the old code.
> 
> No. If you create location string *without* space as prefix as I show you:
> location = 'to: ' + unescape_for_display(location, 'utf-8')
> 
> you won't have any extra space in resulting message.

In the case where no location is passed, there would be an extra space
at the end of the message. The location is never not passed, and nobody
would see the space (and my shell seems to remove it entirely), but that
would still bother me.
-- 



More information about the bazaar mailing list