3
0
mirror of https://git.launchpad.net/ubuntu-dev-tools synced 2025-03-13 08:01:09 +00:00

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 .
This commit is contained in:
Brian Murray 2013-08-22 08:22:55 -07:00
parent 769ccd0f62
commit 0ee01ef534
2 changed files with 13 additions and 4 deletions
debian
ubuntutools/sponsor_patch

8
debian/changelog vendored

@ -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 <brian@ubuntu.com> Thu, 22 Aug 2013 08:20:14 -0700
ubuntu-dev-tools (0.149) unstable; urgency=low ubuntu-dev-tools (0.149) unstable; urgency=low
[ Marc Deslauriers ] [ Marc Deslauriers ]

@ -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] bug_tasks = [BugTask(x, launchpad) for x in bug.bug_tasks]
ubuntu_tasks = [x for x in bug_tasks if x.is_ubuntu_task()] ubuntu_tasks = [x for x in bug_tasks if x.is_ubuntu_task()]
bug_id = bug.id
if branch: if branch:
branch = branch.split('/') branch = branch.split('/')
# Non-production LP? # Non-production LP?
@ -196,7 +197,7 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None):
branch = branch[3:] branch = branch[3:]
if len(ubuntu_tasks) == 0: 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) sys.exit(1)
elif len(ubuntu_tasks) == 1: elif len(ubuntu_tasks) == 1:
task = ubuntu_tasks[0] task = ubuntu_tasks[0]
@ -212,17 +213,17 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None):
elif len(ubuntu_tasks) > 1: elif len(ubuntu_tasks) > 1:
task_list = [t.get_short_info() for t in ubuntu_tasks] 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), 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()] open_ubuntu_tasks = [x for x in ubuntu_tasks if not x.is_complete()]
if len(open_ubuntu_tasks) == 1: if len(open_ubuntu_tasks) == 1:
task = open_ubuntu_tasks[0] task = open_ubuntu_tasks[0]
else: else:
Logger.normal("https://launchpad.net/bugs/%i has %i Ubuntu tasks:" \ 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)): for i in xrange(len(ubuntu_tasks)):
print "%i) %s" % (i + 1, print "%i) %s" % (i + 1,
ubuntu_tasks[i].get_package_and_series()) 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)) 1, len(ubuntu_tasks))
task = ubuntu_tasks[selected - 1] task = ubuntu_tasks[selected - 1]
Logger.info("Selected Ubuntu task: %s" % (task.get_short_info())) Logger.info("Selected Ubuntu task: %s" % (task.get_short_info()))