git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] blameview: Support browsable functionality to blameview.

From
Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Date
Jan 30, 2007, 07:56 UTC
Message-ID
<45befa66.29cc817d.6c37.ffffa9bc@mx.google.com>
In-Reply-To
<11701438241247-git-send-email->
From: Aneesh Kumar K.V <aneesh.kumar@gmail.com> - unquoted

Double clicking on the row exec a new blameview with commit hash as argument.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 contrib/blameview/blameview.perl |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/contrib/blameview/blameview.perl b/contrib/blameview/blameview.perl
index 8261e47..8ad9bcf 100755
--- a/contrib/blameview/blameview.perl
+++ b/contrib/blameview/blameview.perl
@@ -3,7 +3,17 @@
 use Gtk2 -init;
 use Gtk2::SimpleList;
 
-my $fn = shift or die "require filename to blame";
+my $hash;
+my $fn;
+if ( @ARGV == 1 ) {
+	$hash = "HEAD";
+	$fn = shift;
+} elsif ( @ARGV == 2 ) {
+	$hash = shift;
+	$fn = shift;
+} else {
+	die "Usage blameview [<rev>] <filename>";
+}
 
 Gtk2::Rc->parse_string(<<'EOS');
 style "treeview_style"
@@ -27,17 +37,24 @@ $scrolled_window->add($fileview);
 $fileview->get_column(0)->set_spacing(0);
 $fileview->set_size_request(1024, 768);
 $fileview->set_rules_hint(1);
+$fileview->signal_connect (row_activated => sub {
+		my ($sl, $path, $column) = @_;
+		my $row_ref = $sl->get_row_data_from_path ($path);
+		system("blameview @$row_ref[0] $fn");
+		# $row_ref is now an array ref to the double-clicked row's data.
+		});
 
 my $fh;
-open($fh, '-|', "git cat-file blob HEAD:$fn")
+open($fh, '-|', "git cat-file blob $hash:$fn")
   or die "unable to open $fn: $!";
+
 while(<$fh>) {
   chomp;
   $fileview->{data}->[$.] = ['HEAD', '?', "$fn:$.", $_];
 }
 
 my $blame;
-open($blame, '-|', qw(git blame --incremental --), $fn)
+open($blame, '-|', qw(git blame --incremental --), $fn, $hash)
     or die "cannot start git-blame $fn";
 
 Glib::IO->add_watch(fileno($blame), 'in', \&read_blame_line);
-- 
1.5.0.rc2.75.gdbaa0-dirty
Previous: Aneesh Kumar K.VNext: Junio C Hamano
Message 2 of 4 in “blameview: Use git-cat-file to read the file content.”
  1. blameview: Use git-cat-file to read the file content.Aneesh Kumar K.V, Jan 30, 2007
  2. blameview: Support browsable functionality to blameview.Aneesh Kumar K.V, Jan 30, 2007
  3. Junio C HamanoJan 30, 2007
  4. Update git-cat-file documentationAneesh Kumar K.V, Jan 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.