From: Alexander Gavrilov <angavrilov@gmail.com>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>,
"Shawn O. Pearce" <spearce@spearce.org>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk.
Date: Sat, 23 Aug 2008 12:29:08 +0400 [thread overview]
Message-ID: <200808231229.09191.angavrilov@gmail.com> (raw)
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
next prev parent reply other threads:[~2008-08-23 8:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-23 8:25 [PATCH (GITK,GIT-GUI,DOCS) 0/7] Improve gui blame and gitk integration Alexander Gavrilov
2008-08-23 8:27 ` [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit Alexander Gavrilov
2008-08-23 8:29 ` Alexander Gavrilov [this message]
2008-08-26 10:27 ` [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk Paul Mackerras
2008-08-26 12:10 ` Johannes Sixt
2008-08-26 10:13 ` [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit Paul Mackerras
2008-08-23 8:30 ` [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame Alexander Gavrilov
2008-08-23 8:30 ` [PATCH (GITK,GIT-GUI,DOCS) 4/7] git-gui: Support passing blame to a parent commit Alexander Gavrilov
2008-08-23 8:31 ` [PATCH (GITK,GIT-GUI,DOCS) 5/7] git-gui: Better positioning in Blame Parent Commit Alexander Gavrilov
2008-08-23 8:32 ` [PATCH (GITK,GIT-GUI,DOCS) 6/7] git-gui: Allow specifying an initial line for git gui blame Alexander Gavrilov
2008-08-25 5:06 ` [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame Shawn O. Pearce
2008-08-23 8:33 ` [PATCH (GITK,GIT-GUI,DOCS) 7/7] Document new options of gui tools Alexander Gavrilov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808231229.09191.angavrilov@gmail.com \
--to=angavrilov@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=paulus@samba.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.