diff --git a/__init__.py b/__init__.py index abaecea..ad51eef 100644 --- a/__init__.py +++ b/__init__.py @@ -34,7 +34,7 @@ sDefaultFormatSpec = """ commit %H -parents %P +parent %P Author %aN (%aE) Date %aD Commit By %cN (%cE) diff --git a/etc/gitzillarc b/etc/gitzillarc index 591ab3a..22fceac 100644 --- a/etc/gitzillarc +++ b/etc/gitzillarc @@ -5,6 +5,9 @@ # [Section_Name] # item: value # another_item: value2 +# third_item: +# line 1 +# line 2 # @@ -65,7 +68,7 @@ # default: True # # whether the update hook should allow commits which do not contain -# a bug number. True or false. +# a bug number. True or False. # # * allowed_bug_states # @@ -75,18 +78,36 @@ # # * formatspec # -# default: commit %H%nparents %P%nAuthor %aN (%aE)%nDate %aD%nCommit By %cN (%cE)%nCommit Date %cD%n%n%s%n%n%b%n -# -# appended to '--format=format:' in 'git whatchanged'. See the -# 'git whatchanged' manpage for more info. Newlines are automatically -# converted to '%n'. +# default: commit %H%nparent %P%nAuthor %aN (%aE)%nDate %aD%nCommit By %cN (%cE)%nCommit Date %cD%n%n%s%n%n%b%n +# +# appended to '--format=format:' in 'git whatchanged' or 'git log'. +# See the 'git-whatchanged' manpage for more info. Newlines are +# automatically converted to '%n'. +# +# If you want to replace the commits hashes by links to your GitWeb site, +# then enable the Bugzilla extension and put the project name +# before the "commit", "parent" or "tree" words, like in the example +# below. The extension will remove the project name from the output +# while resolving the links. +# +# formatspec: +# author %aN <%aE>%n %aD +# committer %cN <%cE>%n %cD +# MyProject.git commit %H +# MyProject.git parent %P +# MyProject.git tree %T +# %n +# %s +# %n +# %b # # * include_diffstat # # default: True # # include the diffstat (a list of changed files with a histogram). -# If False, the diffstat is not included. True or False. +# If False, the diffstat is not included. In this case 'git log' +# is used in favour of 'git whatchanged'. True or False. # # * separator # @@ -111,12 +132,12 @@ # - Bug #123 # # * git_ref_prefix -# +# # the string which must start a git reference for its commits to be # processed. Defaults to 'refs/heads/' so that we don't process 'tags/' and # run the risk of processing many commits multiple times. You can set it # to the empty string to process all git references. -# +# # * logfile # # the file to log to. Must be writable by the uid of the git @@ -143,4 +164,14 @@ # bugzilla_password: barbarblah # allowed_bug_states: NEW, ASSIGNED, REOPENED # user_config: deny - +# formatspec: +# commit %H +# parent %P +# Author %aN (%aE) +# Date %aD +# Commit By %cN (%cE) +# Commit Date %cD +# %n +# %s +# %n +# %b diff --git a/extensions/Gitzilla/Config.pm b/extensions/Gitzilla/Config.pm index c25f65e..f369e29 100644 --- a/extensions/Gitzilla/Config.pm +++ b/extensions/Gitzilla/Config.pm @@ -1,4 +1,4 @@ -package Bugzilla::Extension::Striiv; +package Bugzilla::Extension::Gitzilla; use strict; use constant NAME => 'Gitzilla'; diff --git a/extensions/Gitzilla/Extension.pm b/extensions/Gitzilla/Extension.pm index 1dccc98..f9d21ad 100644 --- a/extensions/Gitzilla/Extension.pm +++ b/extensions/Gitzilla/Extension.pm @@ -8,22 +8,19 @@ use Data::Dumper; our $VERSION = '1.0'; -#this relies on using a formatspec in /etc/gitzillarc like this (replace tmp.git appropriately): -#formatspec: tmp.git commit %H%d%n%aE%n%s%n%n%b - sub bug_format_comment { my ($self, $args) = @_; my $regexes = $args->{'regexes'}; - my $commit_match = qr/\b((\S+\.git)\s+(?:commit|parents)\b\s+([0-9a-fA-F]{7,40}))/; + my $commit_match = qr/\b((\S+\.git)\s+((?:commit|parent|tree)\b\s+)([0-9a-fA-F]{7,40}))/; push(@$regexes, { match => $commit_match, replace => \&_replace_commit }); } sub _replace_commit { my $args = shift; my $matches = $args->{matches}; - return qq{$matches->[0]}; + return qq{$matches->[2]$matches->[3]}; } __PACKAGE__->NAME; diff --git a/extensions/Gitzilla/README b/extensions/Gitzilla/README index ca43ef8..b940052 100644 --- a/extensions/Gitzilla/README +++ b/extensions/Gitzilla/README @@ -1,6 +1,13 @@ -Move this dir into the bugzilla/extensions/ dir +Move this directory into the bugzilla/extensions/ directory. -edit /etc/gitzillarc to have a formatspec like this (replace tmp.git appropriately): -formatspec: tmp.git commit %H%d%n%aE%n%s%n%n%b +Edit /etc/gitzillarc to have a formatspec like this (replace +MyProject.git appropriately): -edit Extension.pm - change "www.example.com" to your gitweb url +formatspec: + ... + MyProject.git commit %H + MyProject.git parent %P + MyProject.git tree %T + ... + +Edit Extension.pm - change "www.example.com" to your gitweb url