{"thread":{"id":"1661","subject":"[PATCH] gitweb - XMMS2 project customisations","startedAt":"2005-08-26T11:16:05Z","lastAt":"2005-08-26T11:32:05Z","messageCount":2,"participants":["Sham Chukoury","Sven Verdoolaege"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7805","messageId":"430EF9F5.70003@xmms.org","threadId":"1661","inReplyTo":null,"subject":"[PATCH] gitweb - XMMS2 project customisations","fromName":"Sham Chukoury","fromEmail":"eleusis@xmms.org","sentAt":"2005-08-26T11:16:05Z","receivedAt":"2005-08-26T11:16:05Z","isPatch":true,"sender":{"key":"eleusis@xmms.org","avatar":null},"body":"G'day.\n\nI figured you folks might be interested in a number of modifications the \nXMMS2 team have made to gitweb. All the changes can be seen at \nhttp://git.xmms.se\n\n1) Navbar refactoring (gitweb-xmms2navbar.diff)\nThe original idea was to add a link to our snapshots directory, in the \nnavigation bar at the top of every gitweb page. The problem was that the \ncode for producing the navbar HTML was mostly duplicated in various \ndifferent places. I refactored the code so that a single 'git_navbar' \nsubroutine is called every time gitweb needs a navbar. The patch itself \nprobably needs some cleaning up: 1) I omitted the git_navbar call in one \nplace, as the original navbar code there didn't look like the navbar \ncode in other places, 2) there's a 'snapshot link' in the navbar which \nwon't work unless gitweb-xmms2snapshots.diff is also applied \n($snapshots_url isn't defined in gitweb-xmms2navbar.diff)\n\n2) Commit tags support (gitweb-xmms2committags.diff)\nWe originally started using specific commit tags during the development \nof XMMS2 to facilitate the generation of changelogs at every release. \nThis patch reformats commit descriptions containing 'BUG' or 'FEATURE' \nto produce hyperlinks to bug reports on our mantis bug tracker \n(http://bugs.xmms2.xmms.se), as well as linking to release information \npages ('RELEASE' tag). You could adapt this patch to provide support for \nother custom tags. It might also be possible to cleverly integrate the \ncommittags and committags_shortlog subroutines into a single \nsubroutine.. I couldn't figure it out easily enough - my \nPerl(+regexp)-fu isn't strong enough. ;)\n\n3) Snapshot integration (gitweb-xmms2snapshots.diff & snapshot.cgi)\nThis patch makes it possible to easily produce snapshots of every commit \nin a git tree. Hyperlinks to 'snapshot' or 'latest snapshot' are added \nin various places. All you need is to have a CGI script to handle the \nrequest, with 'tree' and 'commit' parameters, where 'tree' refers to a \ngit tree/repository and 'commit' is either a commit hash or 'HEAD'. I'm \nalso attaching snapshot.cgi, the Python script we use to automagically \ngenerate and serve snapshot tarballs, as reference.\n\nHope someone finds these useful.. ;)\nCheers\n-S\n\n\n--- ../gitweb/gitweb.cgi\t2005-08-25 19:25:11.000000000 +0800\n+++ gitweb.cgi\t2005-08-25 20:33:50.000000000 +0800\n@@ -40,6 +40,23 @@\n #my $projects_list = $projectroot;\n my $projects_list = \"index/index.aux\";\n \n+# custom stuff - mantis/commit tags integration\n+sub committags($){\n+\tmy $a = shift;\n+\t$a =~ s!BUG\\(([0-9]*)\\)!<a href=\"http://bugs.xmms2.xmms.se/view.php?id=$1\">BUG($1)</a>!g;\n+\t$a =~ s!FEATURE\\(([0-9]*)\\)!<a href=\"http://bugs.xmms2.xmms.se/view.php?id=$1\">FEATURE($1)</a>!g;\n+\t$a =~ s!RELEASE: (.*)!RELEASE: <a href=\"http://wiki.xmms2.xmms.se/index.php/Release:$1\">$1</a>!g;\n+\treturn $a;\n+}\n+sub committags_shortlog($$){\n+\tmy $a = shift;\n+\tmy $href = shift;\n+\t$a =~ s!BUG\\(([0-9]*)\\)!</a><a href=\"http://bugs.xmms2.xmms.se/view.php?id=$1\">BUG($1)</a><a class=\\\"list\\\" href=\\\"$href\\\">!g;\n+\t$a =~ s!FEATURE\\(([0-9]*)\\)!</a><a href=\"http://bugs.xmms2.xmms.se/view.php?id=$1\">FEATURE($1)</a><a class=\\\"list\\\" href=\\\"$href\\\">!g;\n+\t$a =~ s!RELEASE: (.*)!RELEASE: <a href=\"http://wiki.xmms2.xmms.se/index.php/Release:$1\">$1</a>!g;\n+\treturn $a;\n+}\n+\n # input validation and dispatch\n my $action = $cgi->param('a');\n if (defined $action) {\n@@ -655,7 +672,7 @@\n \t\t\t$line =~ s/$hash_text/$link/;\n \t\t}\n \t}\n-\treturn $line;\n+\treturn committags($line);\n }\n \n sub date_str {\n@@ -979,7 +996,7 @@\n \t\t\t      \"<td><i>\" . escapeHTML(chop_str($co{'author_name'}, 10)) . \"</i></td>\\n\" .\n \t\t\t      \"<td>\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\", -class => \"list\"},\n-\t\t\t      \"<b>\" . escapeHTML($co{'title_short'}) . \"</b>\") .\n+\t\t\t      \"<b>\" . committags_shortlog(escapeHTML($co{'title_short'}), \"$my_uri?p=$project;a=commit;h=$commit\") . \"</b>\") .\n \t\t\t      \"</td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n@@ -1977,7 +1994,7 @@\n \t      \"<br/><br/>\\n\" .\n \t      \"</div>\\n\";\n \tprint \"<div>\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n+\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, committags(escapeHTML($co{'title'}))) . \"\\n\" .\n \t      \"</div>\\n\";\n \tprint \"<div class=\\\"page_path\\\"><b>/$file_name</b><br/></div>\\n\";\n \n@@ -2004,7 +2021,7 @@\n \t\t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n \t\t\t      \"<td><i>\" . escapeHTML(chop_str($co{'author_name'}, 15, 3)) . \"</i></td>\\n\" .\n \t\t\t      \"<td>\" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\", -class => \"list\"}, \"<b>\" .\n-\t\t\t      escapeHTML(chop_str($co{'title'}, 50)) . \"</b>\") . \"</td>\\n\" .\n+\t\t\t      committags(escapeHTML(chop_str($co{'title'}, 50))) . \"</b>\") . \"</td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n \t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=blob;hb=$commit;f=$file_name\"}, \"blob\");\n@@ -2230,7 +2247,7 @@\n \t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n \t\t      \"<td><i>\" . escapeHTML(chop_str($co{'author_name'}, 10)) . \"</i></td>\\n\" .\n \t\t      \"<td>\" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\", -class => \"list\"}, \"<b>\" .\n-\t\t      escapeHTML($co{'title_short'}) . \"</b>\") . \"</td>\\n\" .\n+\t\t      committags_shortlog(escapeHTML($co{'title_short'}), \"$my_uri?p=$project;a=commit;h=$commit\") . \"</b>\") . \"</td>\\n\" .\n \t\t      \"<td class=\\\"link\\\">\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n \t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$commit\"}, \"commitdiff\") .\n\n\n--- ../gitweb/gitweb.cgi\t2005-08-25 19:25:11.000000000 +0800\n+++ gitweb.cgi\t2005-08-26 17:56:41.000000000 +0800\n@@ -40,6 +40,53 @@\n #my $projects_list = $projectroot;\n my $projects_list = \"index/index.aux\";\n \n+# custom stuff - refactored navbar\n+sub git_navbar($$$$) {\n+\tmy $project = shift;\n+\tmy $head = shift;\n+\tmy $curSection = shift;\n+\tmy $extraLinks = shift;\n+\n+\tmy $sumLink = $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\");\n+\tmy $slogLink = $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\");\n+\tmy $logLink = $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\");\n+\tmy $comLink = $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$head\"}, \"commit\");\n+\tmy $comdifLink = $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$head\"}, \"commitdiff\");\n+\tmy $treeLink = $cgi->a({-href => \"$my_uri?p=$project;a=tree\"}, \"tree\");\n+\tmy $snapLink = $cgi->a({-href => \"$snapshots_url?tree=$project&commit=HEAD\"}, \"latest snapshot\");\n+\n+\tif ($curSection eq \"summary\") {\n+\t\t$sumLink = \"summary\";\n+\t}\n+\telsif ($curSection eq \"shortlog\") {\n+\t\t$slogLink = \"shortlog\";\n+\t}\n+\telsif ($curSection eq \"log\") {\n+\t\t$logLink = \"log\";\n+\t}\n+\telsif ($curSection eq \"commit\") {\n+\t\t$comLink = \"commit\";\n+\t}\n+\telsif ($curSection eq \"commitdiff\") {\n+\t\t$comdifLink = \"commitdiff\";\n+\t}\n+\telsif ($curSection eq \"tree\") {\n+\t\t$treeLink = \"tree\";\n+\t}\n+\n+\tmy $retVal = \"<div class=\\\"page_nav\\\">\\n\" .\n+\t      $sumLink .\n+\t      \" | \" . $slogLink .\n+\t      \" | \" . $logLink .\n+\t      \" | \" . $comLink .\n+\t      \" | \" . $comdifLink .\n+\t      \" | \" . $treeLink .\n+\t      \" | \" . $snapLink .\n+\t      \"<br/>$extraLinks<br/>\\n\" .\n+\t      \"</div>\\n\";\n+\treturn $retVal;\n+}\n+\n # input validation and dispatch\n my $action = $cgi->param('a');\n if (defined $action) {\n@@ -941,15 +988,7 @@\n \t}\n \n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      \"summary\".\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$head\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$head\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree\"}, \"tree\") .\n-\t      \"<br/><br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $head, \"summary\", \"\");\n \tprint \"<div class=\\\"title\\\">&nbsp;</div>\\n\";\n \tprint \"<table cellspacing=\\\"0\\\">\\n\" .\n \t      \"<tr><td>description</td><td>\" . escapeHTML($descr) . \"</td></tr>\\n\" .\n@@ -1087,15 +1126,7 @@\n sub git_tag {\n \tmy $head = git_read_hash(\"$project/HEAD\");\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$head\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$head\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;hb=$head\"}, \"tree\") . \"<br/>\\n\" .\n-\t      \"<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $head, \"tag\", \"\");\n \tmy %tag = git_read_tag($hash);\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, escapeHTML($tag{'name'})) . \"\\n\" .\n@@ -1126,15 +1157,7 @@\n sub git_tags {\n \tmy $head = git_read_hash(\"$project/HEAD\");\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$head\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$head\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;hb=$head\"}, \"tree\") . \"<br/>\\n\" .\n-\t      \"<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $head, \"tags\", \"\");\n \tmy $taglist = git_read_refs(\"refs/tags\");\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\", -class => \"title\"}, \"&nbsp;\") .\n@@ -1185,15 +1208,7 @@\n sub git_branches {\n \tmy $head = git_read_hash(\"$project/HEAD\");\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$head\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$head\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;hb=$head\"}, \"tree\") . \"<br/>\\n\" .\n-\t      \"<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $head, \"branches\", \"\");\n \tmy $taglist = git_read_refs(\"refs/heads\");\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\", -class => \"title\"}, \"&nbsp;\") .\n@@ -1263,15 +1278,7 @@\n \tmy $base = $file_name || \"\";\n \tgit_header_html();\n \tif (defined $hash_base && (my %co = git_read_commit($hash_base))) {\n-\t\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\"}, \"commit\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash_base\"}, \"commitdiff\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base\"}, \"tree\") . \"<br/>\\n\";\n-\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=blob_plain;h=$hash\"}, \"plain\") . \"<br/>\\n\" .\n-\t\t      \"</div>\\n\";\n+\t\tprint git_navbar($project, $hash_base, \"blob\", $cgi->a({-href => \"$my_uri?p=$project;a=blob_plain;h=$hash\"}, \"plain\"));\n \t\tprint \"<div>\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\", -class => \"title\"}, escapeHTML($co{'title'})) .\n \t\t      \"</div>\\n\";\n@@ -1331,15 +1338,7 @@\n \tmy $base = \"\";\n \tif (defined $hash_base && (my %co = git_read_commit($hash_base))) {\n \t\t$base_key = \";hb=$hash_base\";\n-\t\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash_base\"}, \"shortlog\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash_base\"}, \"log\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\"}, \"commit\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash_base\"}, \"commitdiff\") .\n-\t\t      \" | tree\" .\n-\t\t      \"<br/><br/>\\n\" .\n-\t\t      \"</div>\\n\";\n+\t\tprint git_navbar($project, $hash_base, \"tree\", \"\");\n \t\tprint \"<div>\\n\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t\t      \"</div>\\n\";\n@@ -1493,38 +1492,31 @@\n \t\t$page = 0;\n \t}\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\";\n-\tprint $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash\"}, \"shortlog\") .\n-\t      \" | log\" .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$hash;hb=$hash\"}, \"tree\") . \"<br/>\\n\";\n \n+\tmy $navExtra = \"\";\n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n \topen my $fd, \"-|\", \"$gitbin/git-rev-list $limit $hash\" or die_error(undef, \"Open failed.\");\n \tmy (@revlist) = map { chomp; $_ } <$fd>;\n \tclose $fd;\n \n \tif ($hash ne $head || $page) {\n-\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"HEAD\");\n+\t\t$navExtra .= $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"HEAD\");\n \t} else {\n-\t\tprint \"HEAD\";\n+\t\t$navExtra .= \"HEAD\";\n \t}\n \tif ($page > 0) {\n-\t\tprint \" &sdot; \" .\n+\t\t$navExtra .= \" &sdot; \" .\n \t\t$cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash;pg=\" . ($page-1), -accesskey => \"p\", -title => \"Alt-p\"}, \"prev\");\n \t} else {\n-\t\tprint \" &sdot; prev\";\n+\t\t$navExtra .= \" &sdot; prev\";\n \t}\n \tif ($#revlist >= (100 * ($page+1)-1)) {\n-\t\tprint \" &sdot; \" .\n+\t\t$navExtra .= \" &sdot; \" .\n \t\t$cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash;pg=\" . ($page+1), -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n \t} else {\n-\t\tprint \" &sdot; next\";\n+\t\t$navExtra .= \" &sdot; next\";\n \t}\n-\tprint \"<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $hash, \"log\", $navExtra);\n \tif (!@revlist) {\n \t\tprint \"<div>\\n\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\", -class => \"title\"}, \"&nbsp;\") .\n@@ -1593,6 +1585,7 @@\n \t@difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading diff-tree failed.\");\n \tgit_header_html();\n+\t# git_navbar omitted here - commitdiff link a bit weird o_O\n \tprint \"<div class=\\\"page_nav\\\">\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n \t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash\"}, \"shortlog\") .\n@@ -1773,16 +1766,7 @@\n \tmkdir($git_temp, 0700);\n \tgit_header_html();\n \tif (defined $hash_base && (my %co = git_read_commit($hash_base))) {\n-\t\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\"}, \"commit\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash_base\"}, \"commitdiff\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base\"}, \"tree\") .\n-\t\t      \"<br/>\\n\";\n-\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent\"}, \"plain\") .\n-\t\t      \"</div>\\n\";\n+\t\tprint git_navbar($project, $hash_base, \"blobdiff\", $cgi->a({-href => \"$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent\"}, \"plain\"));\n \t\tprint \"<div>\\n\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash_base\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t\t      \"</div>\\n\";\n@@ -1825,15 +1809,7 @@\n \tclose $fd or die_error(undef, \"Reading diff-tree failed.\");\n \n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\"}, \"commit\") .\n-\t      \" | commitdiff\" .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") . \"<br/>\\n\";\n-\tprint $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent\"}, \"plain\") . \"\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $hash, \"commitdiff\", $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent\"}, \"plain\"));\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t      \"</div>\\n\";\n@@ -1967,15 +1943,7 @@\n \t\tdie_error(undef, \"Unknown commit object.\");\n \t}\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") .\n-\t      \"<br/><br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $hash, \"history\", \"\");\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t      \"</div>\\n\";\n@@ -2051,15 +2019,7 @@\n \t\t$pickaxe_search = 1;\n \t}\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary;h=$hash\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") .\n-\t      \"<br/><br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $hash, \"search\", \"\");\n \n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n@@ -2180,38 +2140,31 @@\n \t\t$page = 0;\n \t}\n \tgit_header_html();\n-\tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | shortlog\" .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash\"}, \"log\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$hash\"}, \"commit\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\"}, \"commitdiff\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$hash;hb=$hash\"}, \"tree\") . \"<br/>\\n\";\n \n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n \topen my $fd, \"-|\", \"$gitbin/git-rev-list $limit $hash\" or die_error(undef, \"Open failed.\");\n \tmy (@revlist) = map { chomp; $_ } <$fd>;\n \tclose $fd;\n \n+\tmy $navExtra = \"\";\n \tif ($hash ne $head || $page) {\n-\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"HEAD\");\n+\t\t$navExtra .= $cgi->a({-href => \"$my_uri?p=$project;a=shortlog\"}, \"HEAD\");\n \t} else {\n-\t\tprint \"HEAD\";\n+\t\t$navExtra .= \"HEAD\";\n \t}\n \tif ($page > 0) {\n-\t\tprint \" &sdot; \" .\n+\t\t$navExtra .= \" &sdot; \" .\n \t\t$cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash;pg=\" . ($page-1), -accesskey => \"p\", -title => \"Alt-p\"}, \"prev\");\n \t} else {\n-\t\tprint \" &sdot; prev\";\n+\t\t$navExtra .= \" &sdot; prev\";\n \t}\n \tif ($#revlist >= (100 * ($page+1)-1)) {\n-\t\tprint \" &sdot; \" .\n+\t\t$navExtra .= \" &sdot; \" .\n \t\t$cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash;pg=\" . ($page+1), -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n \t} else {\n-\t\tprint \" &sdot; next\";\n+\t\t$navExtra .= \" &sdot; next\";\n \t}\n-\tprint \"<br/>\\n\" .\n-\t      \"</div>\\n\";\n+\tprint git_navbar($project, $hash, \"shortlog\", $navExtra);\n \tprint \"<div>\\n\" .\n \t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\", -class => \"title\"}, \"&nbsp;\") .\n \t      \"</div>\\n\";\n\n\n--- ../gitweb/gitweb.cgi\t2005-08-25 19:25:11.000000000 +0800\n+++ gitweb.cgi\t2005-08-26 17:50:57.000000000 +0800\n@@ -40,6 +40,8 @@\n #my $projects_list = $projectroot;\n my $projects_list = \"index/index.aux\";\n \n+my $snapshots_url = \"http://git.xmms.se/snapshot.cgi\";\n+\n # input validation and dispatch\n my $action = $cgi->param('a');\n if (defined $action) {\n@@ -845,6 +847,7 @@\n \t\t      $cgi->a({-href => \"$my_uri?p=$pr->{'path'};a=summary\"}, \"summary\") .\n \t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$pr->{'path'};a=shortlog\"}, \"shortlog\") .\n \t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$pr->{'path'};a=log\"}, \"log\") .\n+\t\t      \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$pr->{'path'}&commit=HEAD\"}, \"latest snapshot\") .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\\n\";\n \t}\n@@ -984,6 +987,7 @@\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n \t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$commit\"}, \"commitdiff\") .\n+\t\t\t      \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$project&commit=$commit\"}, \"snapshot\") .\n \t\t\t      \"</td>\\n\" .\n \t\t\t      \"</tr>\";\n \t\t} else {\n@@ -1033,7 +1037,8 @@\n \t\t\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}\"}, $tag{'reftype'});\n \t\t\t\tif ($tag{'reftype'} eq \"commit\") {\n \t\t\t\t      print \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$tag{'name'}\"}, \"shortlog\") .\n-\t\t\t\t            \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$tag{'refid'}\"}, \"log\");\n+\t\t\t\t            \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$tag{'refid'}\"}, \"log\") .\n+\t\t\t\t            \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$project&commit=$tag{'refid'}\"}, \"snapshot\");\n \t\t\t\t}\n \t\t\t\tprint \"</td>\\n\" .\n \t\t\t\t      \"</tr>\";\n@@ -1172,7 +1177,8 @@\n \t\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}\"}, $tag{'reftype'});\n \t\t\tif ($tag{'reftype'} eq \"commit\") {\n \t\t\t      print \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$tag{'name'}\"}, \"shortlog\") .\n-\t\t\t            \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$tag{'refid'}\"}, \"log\");\n+\t\t\t            \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$tag{'refid'}\"}, \"log\") .\n+\t\t\t            \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$project&commit=$tag{'refid'}\"}, \"snapshot\");\n \t\t\t}\n \t\t\tprint \"</td>\\n\" .\n \t\t\t      \"</tr>\";\n@@ -1545,6 +1551,7 @@\n \t\t      \"<div class=\\\"log_link\\\">\\n\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n \t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$commit\"}, \"commitdiff\") .\n+\t\t      \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$project&commit=$commit\"}, \"snapshot\") .\n \t\t      \"<br/>\\n\" .\n \t\t      \"</div>\\n\" .\n \t\t      \"<i>\" . escapeHTML($co{'author_name'}) .  \" [$ad{'rfc2822'}]</i><br/>\\n\" .\n@@ -1646,6 +1653,8 @@\n \t\t      \"</td>\" .\n \t\t      \"</tr>\\n\";\n \t}\n+\tprint \"<tr><td>snapshot</td>\".\n+\t      \"<td><a href=\\\"$snapshots_url?tree=$project&commit=$hash\\\">$hash</a></td></tr>\";\n \tprint \"</table>\". \n \t      \"</div>\\n\";\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n@@ -2234,6 +2243,7 @@\n \t\t      \"<td class=\\\"link\\\">\" .\n \t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$commit\"}, \"commit\") .\n \t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$commit\"}, \"commitdiff\") .\n+\t\t      \" | \" . $cgi->a({-href => \"$snapshots_url?tree=$project&commit=$commit\"}, \"snapshot\") .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\";\n \t}\n"},{"id":"7806","messageId":"20050826113205.GI14875MdfPADPa@garage.linux.student.kuleuven.ac.be","threadId":"1661","inReplyTo":"430EF9F5.70003@xmms.org","subject":"Re: [PATCH] gitweb - XMMS2 project customisations","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2005-08-26T11:32:05Z","receivedAt":"2005-08-26T11:32:05Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Fri, Aug 26, 2005 at 07:16:05PM +0800, Sham Chukoury wrote:\n> G'day.\n> \n> I figured you folks might be interested in a number of modifications the \n> XMMS2 team have made to gitweb. All the changes can be seen at \n> http://git.xmms.se\n> \n> 1) Navbar refactoring (gitweb-xmms2navbar.diff)\n> 3) Snapshot integration (gitweb-xmms2snapshots.diff & snapshot.cgi)\n\nI've sent similar patches to the git mailing list almost two\nmonths ago, but Kay didn't take them.\nMaybe you could compare with my version\n\nhttp://www.liacs.nl/~sverdool/gitweb.cgi?p=gitweb.git;a=summary\n\n(I'll be mostly offline for the next couple of days.)\n\nskimo\n"}]}