enhanced auto-corelation between issue and code revision

This commit is contained in:
hyung-hwan 2016-01-23 06:01:04 +00:00
parent 15604fe69a
commit 25e7e9e969
7 changed files with 48 additions and 14 deletions

View File

@ -115,11 +115,18 @@ sub find_issue_reference_in_commit_message
# find [[#IXXXX]] # find [[#IXXXX]]
my @issue_ids = ($commit_message =~ /\[\[#I(\d+)\]\]/g); my @issue_ids = ($commit_message =~ /\[\[#I(\d+)\]\]/g);
# find #XXXX
my @issue_ids2 = ($commit_message =~ /(^|[^#])#(\d+)(\D|$)/g);
# find unique issue ids in the findings. # find unique issue ids in the findings.
my %tmp; my %tmp;
@tmp{@issue_ids} = 1; @tmp{@issue_ids} = 1;
my @unique_issue_ids=keys %tmp; for (my $i = 0; $i < scalar(@issue_ids2); $i += 3)
{
my $id = @issue_ids2[$i + 1];
@tmp{$id} = 1;
}
my @unique_issue_ids = keys(%tmp);
$dbh->begin_work (); $dbh->begin_work ();

View File

@ -99,11 +99,18 @@ sub find_issue_reference_in_commit_message
# find [[#IXXXX]] # find [[#IXXXX]]
my @issue_ids = ($commit_message =~ /\[\[#I(\d+)\]\]/g); my @issue_ids = ($commit_message =~ /\[\[#I(\d+)\]\]/g);
# find #XXXX
my @issue_ids2 = ($commit_message =~ /(^|[^#])#(\d+)(\D|$)/g);
# find unique issue ids in the findings. # find unique issue ids in the findings.
my %tmp; my %tmp;
@tmp{@issue_ids} = 1; @tmp{@issue_ids} = 1;
my @unique_issue_ids=keys %tmp; for (my $i = 0; $i < scalar(@issue_ids2); $i += 3)
{
my $id = @issue_ids2[$i + 1];
@tmp{$id} = 1;
}
my @unique_issue_ids = keys(%tmp);
$dbh->begin_work (); $dbh->begin_work ();

View File

@ -680,14 +680,28 @@ $history = $file['history'];
foreach ($related_issues as $ri) foreach ($related_issues as $ri)
{ {
$hex_issueid = $this->converter->AsciiToHex ($ri->issueid); $hex_issueid = $this->converter->AsciiToHex ($ri->issueid);
//$transformed_message = preg_replace ("/\[\[#I{$ri->issueid}\]\]/", anchor ("/issue/show/{$ri->projectid}/{$hex_issueid}", $ri->issueid . ':' . htmlspecialchars($ri->summary), "class='codepot-issue-type-{$ri->type}'"), $transformed_message);
//$transformed_message = preg_replace ("/\[\[(#I{$ri->issueid})\]\]/", "[[<span class='codepot-issue-type-{$ri->type}'>\${1}</span>]]", $transformed_message); // handle [[#IXXX]]
$transformed_message = preg_replace ( $transformed_message = preg_replace (
"/\[\[(#I{$ri->issueid})\]\]/", "/\[\[(#I{$ri->issueid})\]\]/",
'[[' . anchor ("/issue/show/{$ri->projectid}/{$hex_issueid}", "\${1}", "class='codepot-issue-type-{$ri->type}'") . ']]', '[[' . anchor ("/issue/show/{$ri->projectid}/{$hex_issueid}", "\${1}", "class='codepot-issue-type-{$ri->type}'") . ']]',
$transformed_message $transformed_message
); );
// handle #XXXX. ##XXXX or some weird variants are not allowed.
$transformed_message = preg_replace (
"/(^|[^#])#{$ri->issueid}([^[:digit:]]|$)/",
"\${1}" . anchor ("/issue/show/{$ri->projectid}/{$hex_issueid}", "#{$ri->issueid}", "class='codepot-issue-type-{$ri->type}'") . "\${2}",
$transformed_message
);
} }
// handle [[#RXXX]]
$transformed_message = preg_replace (
"/\[\[(#R([[:digit:]]+))\]\]/",
'[[' . anchor ("/code/revision/{$project->id}/!./\${2}", "\${1}", "class='codepot-hashed-revision-number'") . ']]',
$transformed_message
);
?> ?>
<pre id="code_revision_metadata_text"><?php print $transformed_message; ?></pre> <pre id="code_revision_metadata_text"><?php print $transformed_message; ?></pre>
</div> </div>

View File

@ -1012,6 +1012,7 @@ function print_issue_state ($con, $issue, $old, $issue_type_array, $issue_status
if (!empty($related_code_revisions)) if (!empty($related_code_revisions))
{ {
print '<ul id="issue_show_coderev_list" class="codepot-horizontal-list">'; print '<ul id="issue_show_coderev_list" class="codepot-horizontal-list">';
print '<li><i class="fa fa-hand-o-right"></i> ' . $this->lang->line ('Code') . '</li>';
foreach ($related_code_revisions as $r) foreach ($related_code_revisions as $r)
{ {
print '<li>'; print '<li>';

View File

@ -291,10 +291,10 @@ foreach ($latest_projects as $project)
<?php print $this->lang->line('Open issues')?> <?php print $this->lang->line('Open issues')?>
</div> </div>
<ul id="site_home_result_open_issues_list" class="collapsible-box-list"> <ul id="site_home_result_open_issues_list" class="collapsible-box-list">
<?php <?php
/*
TODO: show site issue stats.
foreach ($open_issue_counts_per_project as $issue) foreach ($open_issue_counts_per_project as $issue)
{ {
$pro = $issue->projectid; $pro = $issue->projectid;
@ -308,6 +308,7 @@ foreach ($latest_projects as $project)
$proissueanc = anchor ("issue/home/{$issue->projectid}", $pro); $proissueanc = anchor ("issue/home/{$issue->projectid}", $pro);
print "<li>{$proissueanc} <span class='codepot-open-issue-count'>{$issue->issue_count}</span></li>"; print "<li>{$proissueanc} <span class='codepot-open-issue-count'>{$issue->issue_count}</span></li>";
} }
*/
foreach ($issues as $issue) foreach ($issues as $issue)
{ {

View File

@ -1046,10 +1046,10 @@ ul.codepot-horizontal-list li {
float: left; float: left;
} }
.codepot-opacity-85 {
filter:alpha(opacity=85); /* IE */ .codepot-hashed-revision-number {
opacity: 0.85; /* Safari, Opera */ /* #RXXXX */
-moz-opacity:0.85; /* FireFox */ background-color: #CACACA;
} }
/* === common issue class === */ /* === common issue class === */

View File

@ -150,9 +150,13 @@ textarea.codepot-issue-edit-comment {
margin-top: 2em; margin-top: 2em;
} }
#issue_show_coderev_list li:nth-child(1) i {
color: #BB4533;
}
#issue_show_coderev_list a { #issue_show_coderev_list a {
color: #FFFFFF; color: #444444;
background-color: #45A067; background-color: #CECECE;
padding: 0.3em; padding: 0.3em;
-moz-border-radius: 3px; -moz-border-radius: 3px;