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

[PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk.

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Aug 23, 2008, 08:29 UTC
Message-ID
<200808231229.09191.angavrilov@gmail.com>
In-Reply-To
<200808231227.45013.angavrilov@gmail.com>

Add a new item to the file list popup menu, that calls git gui blame for the selected file, starting with the first parent of the current commit.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 gitk |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 7698b70..2eaa2ae 100755
--- a/gitk
+++ b/gitk
@@ -2214,6 +2214,8 @@ proc makewindow {} {
 	-command {flist_hl 1}
     $flist_menu add command -label [mc "External diff"] \
         -command {external_diff}
+    $flist_menu add command -label [mc "Blame parent commit"] \
+        -command {external_blame 1}
 }
 
 # Windows sends all mouse wheel events to the current focused window, not
@@ -3021,6 +3023,27 @@ proc external_diff {} {
     }
 }
 
+proc external_blame {parent_idx} {
+    global flist_menu_file
+    global nullid nullid2
+    global parentlist selectedline currentid
+
+    if {$parent_idx > 0} {
+	set base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]
+    } else {
+	set base_commit $currentid
+    }
+
+    if {$base_commit eq {} || $base_commit eq $nullid || $base_commit eq $nullid2} {
+	error_popup [mc "No such commit"]
+	return
+    }
+
+    if {[catch {exec git gui blame $base_commit $flist_menu_file &} err]} {
+	error_popup [mc "git gui blame: command failed: $err"]
+    }
+}
+
 # delete $dir when we see eof on $f (presumably because the child has exited)
 proc delete_at_eof {f dir} {
     while {[gets $f line] >= 0} {}
-- 
1.6.0.rc2
Previous: Alexander GavrilovNext: Paul Mackerras
Message 3 of 12 in “Improve gui blame and gitk integration”
  1. 0/7 Improve gui blame and gitk integrationAlexander Gavrilov, Aug 23, 2008
  2. 1/7 gitk: Allow overriding the default commit.Alexander Gavrilov, Aug 23, 2008
  3. 2/7 gitk: Support calling git gui blame from gitk.Alexander Gavrilov, Aug 23, 2008
  4. Paul MackerrasAug 26, 2008
  5. Johannes SixtAug 26, 2008
  6. Paul MackerrasAug 26, 2008
  7. 3/7 git-gui: Support starting gitk from Gui BlameAlexander Gavrilov, Aug 23, 2008
  8. 4/7 git-gui: Support passing blame to a parent commit.Alexander Gavrilov, Aug 23, 2008
  9. 5/7 git-gui: Better positioning in Blame Parent CommitAlexander Gavrilov, Aug 23, 2008
  10. 6/7 git-gui: Allow specifying an initial line for git gui blame.Alexander Gavrilov, Aug 23, 2008
  11. Shawn O. PearceAug 25, 2008
  12. 7/7 Document new options of gui tools.Alexander Gavrilov, Aug 23, 2008

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.