2013-03-09 2 views
1

버그 씰라 확장 프로그램을 지키려면 도움이 필요합니다.실행되지 않는 Bugzilla 확장을 디버깅하는 방법은 무엇입니까?

내가 bug_format_comment에 후크 할 (FWIW :. 내가 커밋 각각의 SCM에 대한 링크를 SVN에 커밋 때 자동으로 주석으로 추가 된 일부 일반 텍스트를 변경)

는 지금, 아무것도 때 발생하는 것 같다 I 수동으로 버그에 코멘트를 추가하십시오.

/extensions/my-ext-name/dir에 넣는 것 외에 확장을 실행하기 위해 필요한 특별한 것이 있습니까? 확장 프로그램이 전혀 호출되지 않았는지 어떻게 테스트 할 수 있습니까?

이전 버전의 Bugzilla (3.2.x)를 사용합니다. 그 고리가 지원되는 것일까? (나는 문서에서 그 정보를 찾을 수 없다).

가 여기 내 전체 Extension.pm 파일이다 (I 펄 경험이없는. 나는 예 확장에서 후크의 예를 가져다가 거기에서 실행), 확장하지 않습니다 심지어 부하 서면으로

package Bugzilla::Extension::Websvn-scmbug-autolink; 
use strict; 
use base qw(Bugzilla::Extension); 
# This code for this is in ./extensions/Websvn-scmbug-autolink/lib/Util.pm 
use Bugzilla::Extension::Websvn-scmbug-autolink::Util; 
use URI::Escape; 

our $VERSION = '0.01'; 

# See the documentation of Bugzilla::Hook ("perldoc Bugzilla::Hook" 
# in the bugzilla directory) for a list of all available hooks. 
sub install_update_db { 
    my ($self, $args) = @_; 

} 

sub bug_format_comment { 
    my ($self, $args) = @_; 


    my $regexes = $args->{'regexes'}; 
    # push(@$regexes, { match => qr/\bfoo\b/, replace => 'bar' }); 


# 6665 --> 6666 
# CTUFramework:trunk/CTUCsharpRuntime/CtuFramework/text1-renamed.txt 
    #my $bar_match = qr/\b(bar)\b/; 
    my $bar_match = qr/(?:^|\r|\n)(\d+|NONE) (-->) (\d+|NONE)[ \r\n\t]+([^:]+):(.*?)[\r\n]/s; #/s - treat as single line 
    push(@$regexes, { match => $bar_match, replace => \&_replace_bar }); 
    my $scm_match2 = qr/(?:^|\r|\n)(\d+|NONE) (-->) (\d+|NONE)[ \r\n\t]+([^:]+):(.*?)[\r\n]/s; #/s - treat as single line 
    push(@$regexes, { match => $scm_match2, replace => \&_replace_bar }); 
} 

# Used by bug_format_comment--see its code for an explanation. 
sub _replace_bar { 
    my $args = shift; 

    my $scmFromVer = $args->{matches}->[0]; 
    my $scmToVer = $args->{matches}->[1]; 
    my $scmArrow = $args->{matches}->[2]; 
    my $scmProject = $args->{matches}->[3]; 
    my $scmFile = $args->{matches}->[4]; 
    # Remember, you have to HTML-escape any data that you are returning! 
    my $websvnRoot = "http://devlinux/websvn"; 
    my $websvnRepo = uri_escape($scmProject); #maybe do a mapping 
    my $websvnFilePath = uri_escape("/".$scmFile); 

    my $fromRevUrl = sprintf("%s/revision.php?repname=%s&rev=%s", 
     $websvnRoot, $websvnRepo, $scmFromVer); 
    my $toRevUrl = sprintf("%s/revision.php?repname=%s&rev=%s", 
     $websvnRoot, $websvnRepo, $scmToVer); 
    my $diffUrl = sprintf("%s/diff.php?repname=%s&path=%s&rev=%s", 
     $websvnRoot, $websvnRepo, $websvnFilePath, $scmToVer); 
    my $fileUrl = sprintf("%s/filedetails.php?repname=%s&path=%s&rev=%s", 
     $websvnRoot, $websvnRepo, $websvnFilePath, $scmToVer); 

    # TODO no link for 'NONE' 
    my $fromRevLink = sprintf(qq{<a href="%s">%s</a>}, $fromRevUrl, $scmFromVer); 
    my $toRevLink = sprintf(qq{<a href="%s">%s</a>}, $toRevUrl, $scmToVer); 
    my $diffLink = sprintf(qq{<a href="%s">%s</a>}, $diffUrl, $scmArrow); 
    my $fileLink = sprintf(qq{<a href="%s">%s</a>}, $fileUrl, $scmFilePath); 
    # $match = html_quote($match); 
    return "$fromRevLink $diffLink $toRevLink:$fileLink"; 
}; 
__PACKAGE__->NAME; 

답변

0

Bugzilla 소스를 검색하여 버전 3.2.x에서 후크가 지원되지 않는다는 사실을 발견했습니다. 후크는 Bugzilla 3.6에서 소개되었습니다 : http://bzr.mozilla.org/bugzilla/3.6/revision/6762

PS. 나는 주석을 위해 템플릿 스크립트에서 정규 표현식을 바꿔서 해킹했다. 해키,하지만 효과가있다.

2

: 대시는 Perl 패키지 이름에서 유효하지 않습니다.

Websvn-scmbug-autolink에서 Websvn_scmbug_autolink으로 이름을 변경하십시오.

+0

팁 주셔서 감사합니다. 내가 말했듯이, 펄은 나에게 외국어이다 :) –

관련 문제