diff options
| author | Colin Walters <walters@verbum.org> | 2011-08-25 13:59:31 -0400 | 
|---|---|---|
| committer | Owen W. Taylor <otaylor@fishsoup.net> | 2012-02-06 19:39:35 -0500 | 
| commit | e41879dcdfcfb976b38fab4c46ed1fed45945562 (patch) | |
| tree | d3624bf58387f1f5f5aa84f4f1c5f6014c8f85df | |
| parent | e105b5271909824ba79bf31b6ec6e9600bff1c54 (diff) | |
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
| -rwxr-xr-x | git-bz | 16 | 
1 files changed, 14 insertions, 2 deletions
@@ -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)  | 
