diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2008-11-22 13:59:48 -0500 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2008-11-22 13:59:48 -0500 |
commit | 8836bbcb6c8d10fabc10dda1dc52a116ae652b13 (patch) | |
tree | ea0ed955d4abdfd8a0ae83dd5c56a880f9e3faa8 | |
parent | 201bc1b93915b372b7a71756e64e9091df61b0fd (diff) | |
download | git-bz-8836bbcb6c8d10fabc10dda1dc52a116ae652b13.tar.gz |
Make -b/--bugzilla a global option
Allow specifying -b/--bugzilla for all subcommands and not just
for for 'file'
-rwxr-xr-x | git-bz | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -319,7 +319,10 @@ def get_body(commit): # Per-tracker configuration variables # =================================== -def get_default_tracker(): +def get_tracker(): + if global_options.bugzilla != None: + return global_options.bugzilla + try: return git.config('bz.default-tracker', get=True) except CalledProcessError: @@ -422,7 +425,7 @@ def resolve_bug_reference(bug_reference): tracker = bug_reference[0:colon] id = bug_reference[colon + 1:] else: - tracker = get_default_tracker() + tracker = get_tracker() id = bug_reference host = resolve_host_alias(tracker) @@ -903,12 +906,7 @@ def do_file(product_component, since_or_revision_range): description = "".join(lines[i + 1:]).strip() - if global_options.bugzilla: - tracker = global_options.bugzilla - else: - tracker = get_default_tracker() - - bug = Bug.create(tracker, product, component, summary, description) + bug = Bug.create(get_tracker(), product, component, summary, description) if global_options.add_url: add_url(bug, commits) @@ -925,6 +923,8 @@ else: sys.argv[1:2] = [] parser = OptionParser() +parser.add_option("-b", "--bugzilla", metavar="HOST_OR_ALIAS", + help="bug tracker to use") def add_num_option(): parser.add_option("", "--num", metavar="N", @@ -953,8 +953,6 @@ elif command == 'attach': n_args = 2 elif command == 'file': parser.set_usage("git bz file [-<N>] [options] <product>/<component> [<since> | <revision range>]"); - parser.add_option("-b", "--bugzilla", metavar="HOST_OR_ALIAS", - help="bug tracker to file bug on") add_add_url_option() add_num_option() n_args = 2 |