Handle newer gerrit in update blueprint script

Newer gerrit provides the project name and the branch the change is
proposed against as well as the change id itself in the --change
argument to patchset created hooks. This is a behavior change that we
have to handle as old gerrit passed only the change id.

We do this by going to the old behavior of the script by splitting off
the change id from the new string and using only that. Note that this
may not be strictly correct as multiple changes can share a change id
(likely why gerrit made this change in the first place). We can worry
about properly correct behavior in future updates.

Change-Id: Idef56e98ed6c753a58b766024295b2f5147e3aea
diff --git a/jeepyb/cmd/update_blueprint.py b/jeepyb/cmd/update_blueprint.py
index 8b070c2..093e73b 100644
--- a/jeepyb/cmd/update_blueprint.py
+++ b/jeepyb/cmd/update_blueprint.py
@@ -114,9 +114,15 @@
                                 args.commit + '^1..' + args.commit],
                                stdout=subprocess.PIPE).communicate()[0]
 
+    change = args.change
+    if '~' in change:
+        # Newer gerrit provides the change argument in this format:
+        # gtest-org%2Fgtest~master~I117f34aaa4253e0b82b98de9077f7188d55c3f33
+        # So we need to split off the changeid if there is other data in there.
+        change = change.rsplit('~', 1)[1]
     cur = dbconn.cursor()
     cur.execute("select subject, topic from changes where change_key=%s",
-                args.change)
+                change)
     subject, topic = cur.fetchone()
     specs = set([m.group(2) for m in SPEC_RE.finditer(git_log)])