diff options
author | Mason James <mtj@kohaaloha.com> | 2012-09-26 00:33:50 +1200 |
---|---|---|
committer | Jared Camins-Esakov <jcamins@cpbibliography.com> | 2012-11-06 16:11:25 -0500 |
commit | 5b32af9bc1f41f21035f893bc0ad37aaeee017bd (patch) | |
tree | 61dee9052acebd637bbc172dd452cac5f3f4c470 | |
parent | 5d1ef39ca7ce57cc662ebd29930c14dcfff61b95 (diff) | |
download | git-bz-5b32af9bc1f41f21035f893bc0ad37aaeee017bd.tar.gz |
add support to email patch to 'koha-patches' mailing-list, using --mail arg
Conflicts:
git-bz
-rwxr-xr-x | git-bz | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -104,6 +104,11 @@ from xml.etree.cElementTree import ElementTree import base64 import warnings +import smtplib +import random +import string + + # Globals # ======= @@ -1122,6 +1127,7 @@ def get_bug_server(host, path, https, auth_user, auth_password, bz_user, bz_pass return servers[identifier] + # Unfortunately, Bugzilla doesn't set a useful status code for # form posts. Because it's very confusing to claim we succeeded # but not, we look for text in the response indicating success, @@ -1305,6 +1311,19 @@ class Bug(object): print "Attached %s" % filename + if global_options.mail: + N=6 + tempfile = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(N)) + f = open('/tmp/'+tempfile, 'w') + f.write(data) + f.close() + mlist = "koha-patches@lists.koha-community.org" + str1 = "git send-email --quiet --confirm never --to '" + mlist +"' /tmp/"+tempfile + + import os + retvalue = os.system(str1) + print retvalue + # Update specified fields of a bug; keyword arguments are interpreted # as field_name=value def update(self, **changes): @@ -2411,6 +2430,10 @@ def add_edit_option(): parser.add_option("-e", "--edit", action="store_true", help="allow editing the bugzilla comment") +def add_mail_option(): + parser.add_option("-m", "--mail", action="store_true", + help="send email") + def add_fix_option(): parser.add_option("", "--fix", metavar="<bug reference>", help="attach commits and close bug") @@ -2433,12 +2456,13 @@ elif command == 'apply': add_add_url_options() min_args = 0 max_args = 1 + elif command == 'attach': parser.set_usage("git bz attach [options] [<bug reference>] (<commit> | <revision range>)"); add_add_url_options() add_edit_option() + add_mail_option() min_args = 1 - max_args = 2 elif command == 'components': parser.set_usage("git bz components [options] [<product>]"); min_args = 0 |