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

8
debian/changelog vendored
View File

@ -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
[ Marc Deslauriers ]

View File

@ -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()))