diff options
author | Dan Winship <danw@gnome.org> | 2011-07-15 14:25:54 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2011-09-12 09:24:08 -0400 |
commit | 20a5009a593408bddf13ab5e466fb1011acce7bb (patch) | |
tree | 856cd3e878c94266577473efae31fb8915301b47 | |
parent | eda4accbe756cc15efad244a6f11bac8b4a88c17 (diff) | |
download | git-bz-20a5009a593408bddf13ab5e466fb1011acce7bb.tar.gz |
components: new command to list the components of a product
eg
git bz components -b bugzilla.gnome.org gnome-shell
or just
git bz components
if you have defaults configured
https://bugzilla.gnome.org/show_bug.cgi?id=654693
-rwxr-xr-x | git-bz | 40 | ||||
-rw-r--r-- | git-bz.txt | 9 |
2 files changed, 48 insertions, 1 deletions
@@ -2030,6 +2030,38 @@ def do_push(*args): bug = Bug.load(handle) edit_bug(bug, commits) +def do_components(*args): + tracker = get_tracker() + host = resolve_host_alias(tracker) + https = tracker_uses_https(tracker) + path = tracker_get_path(tracker) + auth_user = tracker_get_auth_user(tracker) + auth_password = tracker_get_auth_password(tracker) + + server = get_bug_server(host, path, https, auth_user, auth_password) + + if len(args) == 1: + product = args[0] + else: + product = get_default_product() + if not product: + die("<product> not specified and no default product is configured" + PRODUCT_COMPONENT_HELP) + + try: + response = server.get_xmlrpc_proxy().Product.get({ 'names': product }) + except xmlrpclib.Fault, e: + die(e.faultString) + except xmlrpclib.ProtocolError, e: + die("Unable to retrieve components: %s" % e.errmsg) + + products = response['products'] + if len(products) == 0: + die("No such product '%s' on %s." % (product, host)) + + product = response['products'][0] + for component in product['components']: + print "%s" % component['name'] + ################################################################################ if len(sys.argv) > 1: @@ -2070,6 +2102,10 @@ elif command == 'attach': add_edit_option() min_args = 1 max_args = 2 +elif command == 'components': + parser.set_usage("git bz components [options] [<product>]"); + min_args = 0 + max_args = 1 elif command == 'edit': parser.set_usage("git bz edit [options] (<bug reference> | <commit> | <revision range>)"); parser.add_option("", "--pushed", action="store_true", @@ -2091,7 +2127,7 @@ elif command == 'push': min_args = 0 max_args = 1000 # no max else: - print >>sys.stderr, "Usage: git bz [add-url|apply|attach|edit|file|push] [options]" + print >>sys.stderr, "Usage: git bz [add-url|apply|attach|components|edit|file|push] [options]" sys.exit(1) global_options, args = parser.parse_args() @@ -2109,6 +2145,8 @@ elif command == 'apply': do_apply(*args) elif command == 'attach': do_attach(*args) +elif command == 'components': + do_components(*args) elif command == 'edit': if global_options.pushed: exit @@ -11,6 +11,7 @@ SYNOPSIS 'git bz add-url' <bug reference> (<commit> | <revision range>) 'git bz apply' [-n | --no-add-url] <bug reference> 'git bz attach' [-n | --no-add-url] [-e |--edit] [<bug reference>] (<commit> | <revision range>) +'git bz components' [<product>] 'git bz edit' (<bug reference> | <commit> | <revision range>) 'git bz edit' (--pushed | --fix <bug reference) (<commit> | <revision range>) 'git bz file' [-n | --no-add-url] [[<product>]/<component>] (<commit> | <revision range>) @@ -180,6 +181,14 @@ git bz attach bugzilla.gnome.org:1234 HEAD git bz attach bugzilla.gnome.org:1234 b50ea9bd^.. ---------------------------------------- +components +~~~~~~~~~~ + +'git bz components' [<product>] + +Prints out the list of components for the given product (or the +default product if none is given on the command line). + edit ~~~~ |