Handle projects not using stable/ branch names
Projects like stackforge/os-ansible-deployment don't use stable/ in
their supported branches. The branch names, however, do correspond to
the series name on Launchpad. Without these updates, the series needs to
be updated entirely by hand.
Change-Id: I128b48ddfe0eb9a062c796828dded1b8ebb241bf
Closes-bug: 2000150
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index 807aa46..4f78ca4 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -223,11 +223,13 @@
set_fix_committed(bugtask)
elif args.branch.startswith('proposed/'):
release_fixcommitted(bugtask)
- elif args.branch.startswith('stable/'):
- series = args.branch[7:]
+ else:
+ series = args.branch.rsplit('/', 1)[-1]
+
+ if series:
# Look for a related task matching the series.
for reltask in bugtask.related_tasks:
- if (reltask.bug_target_name.endswith("/" + series) and
+ if (reltask.bug_target_name.endswith(series) and
reltask.status != u'Fix Released' and
task.needs_change('set_fix_committed')):
set_fix_committed(reltask)
@@ -248,10 +250,13 @@
task.needs_change('set_in_progress')):
set_in_progress(bugtask, launchpad,
args.uploader, args.change_url)
- elif args.branch.startswith('stable/'):
- series = args.branch[7:]
+ else:
+ series = args.branch.rsplit('/', 1)[-1]
+
+ if series:
+ # Look for a related task matching the series.
for reltask in bugtask.related_tasks:
- if (reltask.bug_target_name.endswith("/" + series) and
+ if (reltask.bug_target_name.endswith(series) and
task.needs_change('set_in_progress') and
reltask.status not in [u'Fix Committed',
u'Fix Released']):