From e41879dcdfcfb976b38fab4c46ed1fed45945562 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 25 Aug 2011 13:59:31 -0400 Subject: Support pretty bugzilla links like https://bugzilla.gnome.org/12345 Ideally I'd like git-bz to know when a Bugzilla instance supports these, but here at least we'll try parsing them. https://bugzilla.gnome.org/show_bug.cgi?id=657361 --- git-bz | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/git-bz b/git-bz index bff32a2..3e05a41 100755 --- a/git-bz +++ b/git-bz @@ -434,16 +434,28 @@ class BugHandle: if not password: password = tracker_get_auth_password(parseresult.hostname) + bugid = None + # strip off everything after the last '/', so '/bugzilla/show_bug.cgi' # will simply become '/bugzilla' base_path = parseresult.path[:parseresult.path.rfind('/')] - m = re.match("id=([^&]+)", parseresult.query) + # Some bugzilla instances support a nice short bug link like: + # https://bugzilla.gnome.org/12345 + m = re.match(r'/([0-9]+)$', parseresult.path) if m: + bugid = m.group(1) + else: + m = re.match("id=([^&]+)", parseresult.query) + + if m: + bugid = m.group(1) + + if bugid is not None: return BugHandle(host=parseresult.hostname, path=base_path, https=parseresult.scheme=="https", - id=m.group(1), + id=bugid, auth_user=user, auth_password=password) -- cgit