Merge "Fix in database discrimination"
diff --git a/jeepyb/cmd/notify_impact.py b/jeepyb/cmd/notify_impact.py
index 029c5d2..9c505a3 100644
--- a/jeepyb/cmd/notify_impact.py
+++ b/jeepyb/cmd/notify_impact.py
@@ -31,6 +31,7 @@
 from __future__ import print_function
 
 import argparse
+import logging
 import os
 import re
 import smtplib
@@ -43,6 +44,9 @@
 
 from jeepyb import projects
 
+
+logger = logging.getLogger('notify_impact')
+
 BASE_DIR = '/home/gerrit2/review_site'
 EMAIL_TEMPLATE = """
 Hi, I'd like you to take a look at this patch for potential
@@ -140,6 +144,11 @@
     author_class = None
 
     buginfo, buglink = actions.create(project, bug_title, bug_descr, args)
+    logger.info('Created a bug in project %(project)s with title "%(title)s": '
+                '%(buglink)s'
+                % {'project': project,
+                   'title': bug_title,
+                   'buglink': buglink})
 
     # If the author of the merging patch matches our configured
     # subscriber lists, then subscribe the configured victims.
@@ -154,6 +163,9 @@
         config = config.get('subscriber_map', {}).get(author_class, [])
         for subscriber in config:
             actions.subscribe(buginfo, subscriber)
+            logger.info('Subscribed %(subscriber)s to bug %(buglink)s'
+                        % {'subscriber': subscriber,
+                           'buglink': buglink})
 
     return buglink
 
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index 807aa46..43bd6c2 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -206,6 +206,7 @@
     """Apply changes to lp bug tasks, based on hook / branch."""
 
     bugtask = task.lp_task
+    series = None
 
     if args.hook == "change-abandoned":
         add_change_abandoned_message(bugtask, args.change_url,
@@ -223,11 +224,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 +251,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']):