Closed Bug 821410 Opened 12 years ago Closed 11 years ago

Add support for bitbucket for the 'See Also' field

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: mgorny, Assigned: koosha.khajeh)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

Please add support for adding bitbucket project issues in the 'See Also' field.

The bitbucket issue trackers use URLs like:

    https://bitbucket.org/<user>/<project>/issue/<n>

where <user> & <project> would be \S+?, and <n> would be \d+.
Blocks: bz-seealso
Attached patch patch - v1 (obsolete) — Splinter Review
Assignee: create-and-change → koosha.khajeh
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #691993 - Flags: review?(LpSolit)
OS: Linux → All
Hardware: x86_64 → All
Target Milestone: --- → Bugzilla 4.4
Attached patch patch - v1 (obsolete) — Splinter Review
ah, forgot to ignore the case.
Attachment #691993 - Attachment is obsolete: true
Attachment #691993 - Flags: review?(LpSolit)
Attachment #692004 - Flags: review?(LpSolit)
Comment on attachment 692004 [details] [diff] [review]
patch - v1

Move this into the MoreBugUrl extension.
Attachment #692004 - Flags: review?(LpSolit) → review-
Attached patch patch - v2 (obsolete) — Splinter Review
OK then, moved the code to the extension.
Attachment #692004 - Attachment is obsolete: true
Attachment #692238 - Flags: review?(LpSolit)
Comment on attachment 692238 [details] [diff] [review]
patch - v2

>=== added file 'extensions/MoreBugUrl/lib/BitBucket.pm'
>+    return ($uri->authority =~ /^bitbucket.org$/i

It's a regexp, so you must escape dots as \., see bug 825758.


>+            && $uri->path =~ m|\S+/\S+/issue/\d+|i) ? 1 : 0;

\S accepts any non-whitespace character, including /, so this regexp doesn't do its job correctly. You must use [^/] instead of \S.


>+sub _check_value {

It must sanitize URLs. An issue on bitbucket.org can have a URL of the form

  https://bitbucket.org/ehsan/bugzilla-tweaks/issue/13/add-option-to-hide-possible-duplicates-ui

but Bugzilla should only store

  https://bitbucket.org/ehsan/bugzilla-tweaks/issue/13

which will point to the same issue. See how this is done in Bugzilla/BugUrl/Launchpad.pm.
Attachment #692238 - Flags: review?(LpSolit) → review-
Attached patch patch v3Splinter Review
Attachment #692238 - Attachment is obsolete: true
Attachment #697475 - Flags: review?(LpSolit)
Comment on attachment 697475 [details] [diff] [review]
patch v3

>=== added file 'extensions/MoreBugUrl/lib/BitBucket.pm'

>+package Bugzilla::Extension::MoreBugUrl::BitBucket;
>+use strict;
>+use base qw(Bugzilla::BugUrl);

Missing |use 5.10.1|. Also, s/use base/use parent/.


Otherwise looks good. r=LpSolit
Attachment #697475 - Flags: review?(LpSolit) → review+
Flags: approval+
Target Milestone: Bugzilla 4.4 → Bugzilla 5.0
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified extensions/MoreBugUrl/Extension.pm
added extensions/MoreBugUrl/lib/BitBucket.pm
modified extensions/MoreBugUrl/template/en/default/hook/global/user-error-bug_url_invalid_tracker.html.tmpl
Committed revision 8569.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: