Skip to content
This repository was archived by the owner on Mar 16, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

sDefaultFormatSpec = """
commit %H
parents %P
parent %P
Author %aN (%aE)
Date %aD
Commit By %cN (%cE)
Expand Down
51 changes: 41 additions & 10 deletions etc/gitzillarc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# [Section_Name]
# item: value
# another_item: value2
# third_item:
# line 1
# line 2
#


Expand Down Expand Up @@ -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
#
Expand All @@ -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
#
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion extensions/Gitzilla/Config.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Bugzilla::Extension::Striiv;
package Bugzilla::Extension::Gitzilla;
use strict;
use constant NAME => 'Gitzilla';

Expand Down
7 changes: 2 additions & 5 deletions extensions/Gitzilla/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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{<a href="http://www.example.com/gitweb/?p=$matches->[1];a=commit;h=$matches->[2]">$matches->[0]</a>};
return qq{$matches->[2]<a href="http://www.example.com/gitweb/?p=$matches->[1];a=commit;h=$matches->[3]">$matches->[3]</a>};
}

__PACKAGE__->NAME;
15 changes: 11 additions & 4 deletions extensions/Gitzilla/README
Original file line number Diff line number Diff line change
@@ -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