From 0ee01ef53492c9caa3fa0f6166fb979585c4d8c6 Mon Sep 17 00:00:00 2001 From: Brian Murray Date: Thu, 22 Aug 2013 08:22:55 -0700 Subject: [PATCH] ubuntutools/sponsor_patch/sponsor_patch.py: correct grammar regarding which task for the patch, cache bug.id instead of retrieving it up more than once . --- debian/changelog | 8 ++++++++ ubuntutools/sponsor_patch/sponsor_patch.py | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index c530dff..b3d0f80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ubuntu-dev-tools (0.150) UNRELEASED; urgency=low + + * ubuntutools/sponsor_patch/sponsor_patch.py: correct grammar regarding + which task for the patch, cache bug.id instead of retrieving it up more + than once . + + -- Brian Murray Thu, 22 Aug 2013 08:20:14 -0700 + ubuntu-dev-tools (0.149) unstable; urgency=low [ Marc Deslauriers ] diff --git a/ubuntutools/sponsor_patch/sponsor_patch.py b/ubuntutools/sponsor_patch/sponsor_patch.py index 91ed8d4..510d5e1 100644 --- a/ubuntutools/sponsor_patch/sponsor_patch.py +++ b/ubuntutools/sponsor_patch/sponsor_patch.py @@ -189,6 +189,7 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None): """ bug_tasks = [BugTask(x, launchpad) for x in bug.bug_tasks] ubuntu_tasks = [x for x in bug_tasks if x.is_ubuntu_task()] + bug_id = bug.id if branch: branch = branch.split('/') # Non-production LP? @@ -196,7 +197,7 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None): branch = branch[3:] if len(ubuntu_tasks) == 0: - Logger.error("No Ubuntu bug task found on bug #%i." % (bug.id)) + Logger.error("No Ubuntu bug task found on bug #%i." % (bug_id)) sys.exit(1) elif len(ubuntu_tasks) == 1: task = ubuntu_tasks[0] @@ -212,17 +213,17 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None): elif len(ubuntu_tasks) > 1: task_list = [t.get_short_info() for t in ubuntu_tasks] Logger.info("%i Ubuntu tasks exist for bug #%i.\n%s", len(ubuntu_tasks), - bug.id, "\n".join(task_list)) + bug_id, "\n".join(task_list)) open_ubuntu_tasks = [x for x in ubuntu_tasks if not x.is_complete()] if len(open_ubuntu_tasks) == 1: task = open_ubuntu_tasks[0] else: Logger.normal("https://launchpad.net/bugs/%i has %i Ubuntu tasks:" \ - % (bug.id, len(ubuntu_tasks))) + % (bug_id, len(ubuntu_tasks))) for i in xrange(len(ubuntu_tasks)): print "%i) %s" % (i + 1, ubuntu_tasks[i].get_package_and_series()) - selected = input_number("To which Ubuntu tasks do the patch belong", + selected = input_number("To which Ubuntu task does the patch belong", 1, len(ubuntu_tasks)) task = ubuntu_tasks[selected - 1] Logger.info("Selected Ubuntu task: %s" % (task.get_short_info()))