-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
When using the "-a" and "-e" options together on "stg mail", an exception occurs. Using either alone, or specifying all the patches in the series using a range expression (ie, xxx..yyy) does not cause a problem.
[cel@klimt linux]$ stg mail -e -a -vv1 --to=nfs --to=rdma
Checking the validity of the patches ... done
Error: Unhandled exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/stgit/main.py", line 193, in _main
ret = command.func(parser, options, args)
File "/usr/lib/python2.7/site-packages/stgit/commands/mail.py", line 816, in func
msg_id = __send_message('cover', tmpl, options, patches)
File "/usr/lib/python2.7/site-packages/stgit/commands/mail.py", line 368, in __send_message
'patch': (__build_message, 'patch "%s"' % args[0]),
TypeError: not all arguments converted during string formatting
[cel@klimt linux]$ stg mail -e -a -vv1 --to=nfs --to=rdma
Checking the validity of the patches ... done
Error: Unhandled exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/stgit/main.py", line 195, in _main
ret = command.func(parser, options, args)
File "/usr/lib/python2.7/site-packages/stgit/commands/mail.py", line 877, in func
msg_id = __send_message('cover', tmpl, options, patches)
File "/usr/lib/python2.7/site-packages/stgit/commands/mail.py", line 427, in __send_message
'patch': (__build_message, 'patch "%s"' % args[0]),
TypeError: not all arguments converted during string formatting
[cel@klimt linux]$ stg version
Stacked GIT 0.22-19-gca7d-dirty
git version 2.25.2
Python version 2.7.5 (default, Apr 11 2018, 17:41:36)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28.0.1)]
[cel@klimt linux]$
According to https://stackoverflow.com/questions/18053500/typeerror-not-all-arguments-converted-during-string-formatting-python, the % operator in the following code is incorrect or deprecated:
363 def __send_message(type, tmpl, options, *args):
364 """Message sending dispatcher.
365 """
366 (build, outstr) = {
367 'cover': (__build_cover, 'the cover message'),
368 'patch': (__build_message, 'patch "%s"' % args[0]),
369 }[type]
When rewritten thusly:
363 def __send_message(type, tmpl, options, *args):
364 """Message sending dispatcher.
365 """
366 (build, outstr) = {
367 'cover': (__build_cover, 'the cover message'),
368 'patch': (__build_message, 'patch "{0}"'.format(args[0])),
369 }[type]
Then "stg mail -a -e" works as expected.
Metadata
Metadata
Assignees
Labels
No labels