* gitweb.cgi feature request: project list "last change" column to display last change of all heads.
@ 2006-10-15 9:16 Pierre Marc Dumuid
2006-10-15 10:28 ` Junio C Hamano
2006-10-15 12:17 ` Jakub Narebski
0 siblings, 2 replies; 3+ messages in thread
From: Pierre Marc Dumuid @ 2006-10-15 9:16 UTC (permalink / raw)
To: git
Hi,
I am working with the cinelerra-CV group (cvs.cinelerra.org) and we are
starting to use git to develop new patches. Someone has offered to
mirror our git branches to share amongst ourselves at
http://www.pipapo.org/gitweb.
The annoying thing is that in our mirrored personal repositories, we
switch from head to head and push new features in different head, and
then wait for the other developers to review. At the moment, the
getweb.cgi script only shows the "Last Change" for the current branch,
and not all branches, (i.e. it's currently showing "13 days ago" for
cinelerra-pmdumuid, whilst if you click the summary, you'll see I
actually extended one of the branches only "24 hours ago".
2nd feature request it the ability to browse to the next / previous
commit when looking at a commitdiff...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gitweb.cgi feature request: project list "last change" column to display last change of all heads.
2006-10-15 9:16 gitweb.cgi feature request: project list "last change" column to display last change of all heads Pierre Marc Dumuid
@ 2006-10-15 10:28 ` Junio C Hamano
2006-10-15 12:17 ` Jakub Narebski
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2006-10-15 10:28 UTC (permalink / raw)
To: Pierre Marc Dumuid; +Cc: git
Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au> writes:
> The annoying thing is that in our mirrored personal repositories, we
> switch from head to head and push new features in different head, and
> then wait for the other developers to review. At the moment, the
> getweb.cgi script only shows the "Last Change" for the current branch,
> and not all branches, (i.e. it's currently showing "13 days ago" for
> cinelerra-pmdumuid, whilst if you click the summary, you'll see I
> actually extended one of the branches only "24 hours ago".
It is fairly expensive to do without recent core-side support,
but if the site runs version of git from the "next" branch,
you should be able to do something like this.
I'll queue this to "next".
-- >8 --
gitweb: use for-each-ref to show the latest activity across branches
The project list page shows last change from the HEAD branch but
often people would want to view activity on any branch.
Unfortunately that is fairly expensive without the core-side
support. for-each-ref was invented exactly for that.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e4ebce6..a78c8db 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1009,6 +1009,24 @@ sub parse_tag {
return %tag
}
+sub git_get_last_activity {
+ my ($path) = @_;
+ my $fd;
+
+ $git_dir = "$projectroot/$path";
+ open($fd, "-|", git_cmd(), 'for-each-ref',
+ '--format=%(refname) %(committer)',
+ '--sort=-committerdate',
+ 'refs/heads') or return;
+ my $most_recent = <$fd>;
+ close $fd or return;
+ if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
+ my $timestamp = $1;
+ my $age = time - $timestamp;
+ return ($age, age_string($age));
+ }
+}
+
sub parse_commit {
my $commit_id = shift;
my $commit_text = shift;
@@ -2258,16 +2276,11 @@ sub git_project_list {
die_error(undef, "No projects found");
}
foreach my $pr (@list) {
- my $head = git_get_head_hash($pr->{'path'});
- if (!defined $head) {
- next;
- }
- $git_dir = "$projectroot/$pr->{'path'}";
- my %co = parse_commit($head);
- if (!%co) {
+ my (@aa) = git_get_last_activity($pr->{'path'});
+ unless (@aa) {
next;
}
- $pr->{'commit'} = \%co;
+ ($pr->{'age'}, $pr->{'age_string'}) = @aa;
if (!defined $pr->{'descr'}) {
my $descr = git_get_project_description($pr->{'path'}) || "";
$pr->{'descr'} = chop_str($descr, 25, 5);
@@ -2317,7 +2330,7 @@ sub git_project_list {
"</th>\n";
}
if ($order eq "age") {
- @projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects;
+ @projects = sort {$a->{'age'} <=> $b->{'age'}} @projects;
print "<th>Last Change</th>\n";
} else {
print "<th>" .
@@ -2339,8 +2352,8 @@ sub git_project_list {
-class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
"<td>" . esc_html($pr->{'descr'}) . "</td>\n" .
"<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
- print "<td class=\"". age_class($pr->{'commit'}{'age'}) . "\">" .
- $pr->{'commit'}{'age_string'} . "</td>\n" .
+ print "<td class=\"". age_class($pr->{'age'}) . "\">" .
+ $pr->{'age_string'} . "</td>\n" .
"<td class=\"link\">" .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: gitweb.cgi feature request: project list "last change" column to display last change of all heads.
2006-10-15 9:16 gitweb.cgi feature request: project list "last change" column to display last change of all heads Pierre Marc Dumuid
2006-10-15 10:28 ` Junio C Hamano
@ 2006-10-15 12:17 ` Jakub Narebski
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-10-15 12:17 UTC (permalink / raw)
To: git
Pierre Marc Dumuid wrote:
> I am working with the Cinelerra-CV group (cvs.cinelerra.org) and we are
> starting to use git to develop new patches. Someone has offered to
> mirror our git branches to share amongst ourselves at
> http://www.pipapo.org/gitweb.
>
> The annoying thing is that in our mirrored personal repositories, we
> switch from head to head and push new features in different head, and
> then wait for the other developers to review. At the moment, the
> getweb.cgi script only shows the "Last Change" for the current branch,
> and not all branches, (i.e. it's currently showing "13 days ago" for
> cinelerra-pmdumuid, whilst if you click the summary, you'll see I
> actually extended one of the branches only "24 hours ago".
This feature is planned (even if I forgot to mention it in the latest
"[RFC] gitweb wishlist and TODO list"[*1*] thread), but for performance
reasons it waits for git-for-each-ref to be in released version of git, as
it should be used for projects list to not be generated too slow.
But we could add it (although git is now in freezer before 1.4.3 release).
I was thinking about using
$feature{'lastchange'}{'default'} = HEAD | <branchname> | undef
where undef means search all branches for latest commit.
> 2nd feature request it the ability to browse to the next / previous
> commit when looking at a commitdiff...
First, merges can have more than one parent, so "previous" (or rather
"parent") can be ambiguous. Well, we could use first parent... But even
now it is fairly easy to go to the parent commitdiff: click on "commit"
link in the top navigation bar, or on the subject of commit; then click
on the "parent" link in the commit view; then click on "commitdiff" link
in the top navigation bar, or on the subject of commit.
Git philosophy and design precludes any kind of "next" link. Commit object
has only links to parents, never to children. If one really, really need
"next" link, one would need to save branch and where on branch we are
(in the git-name-rev way, e.g. b=HEAD~10) and pray somebody didn't update
the branch.
It should be quite easy to add commit+commitdiff view, though.
[*1*] http://marc.theaimsgroup.com/?t=115082282700003&r=1&w=2
Msg-Id: <egdge3$t12$1@sea.gmane.org>
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-10-15 12:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-15 9:16 gitweb.cgi feature request: project list "last change" column to display last change of all heads Pierre Marc Dumuid
2006-10-15 10:28 ` Junio C Hamano
2006-10-15 12:17 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).