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) 6/7] git-gui: Allow specifying an initial line for git gui blame.
Date: Sat, 23 Aug 2008 12:32:20 +0400 [thread overview]
Message-ID: <200808231232.20592.angavrilov@gmail.com> (raw)
In-Reply-To: <200808231231.35635.angavrilov@gmail.com>
Add a command-line option to make git gui blame automatically
scroll to a specific line in the file. Useful for integration
with other tools.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
git-gui.sh | 13 +++++++++++--
lib/blame.tcl | 4 ++--
lib/browser.tcl | 2 +-
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index b8bbcd5..e5ea9a8 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2282,10 +2282,15 @@ proc usage {} {
switch -- $subcommand {
browser -
blame {
- set subcommand_args {rev? path}
+ if {$subcommand eq "blame"} {
+ set subcommand_args {[--line=<num>] rev? path}
+ } else {
+ set subcommand_args {rev? path}
+ }
if {$argv eq {}} usage
set head {}
set path {}
+ set jump_spec {}
set is_path 0
foreach a $argv {
if {$is_path || [file exists $_prefix$a]} {
@@ -2299,6 +2304,9 @@ blame {
set path {}
}
set is_path 1
+ } elseif {[regexp {^--line=(\d+)$} $a a lnum]} {
+ if {$jump_spec ne {} || $head ne {}} usage
+ set jump_spec [list $lnum]
} elseif {$head eq {}} {
if {$head ne {}} usage
set head $a
@@ -2330,6 +2338,7 @@ blame {
switch -- $subcommand {
browser {
+ if {$jump_spec ne {}} usage
if {$head eq {}} {
if {$path ne {} && [file isdirectory $path]} {
set head $current_branch
@@ -2345,7 +2354,7 @@ blame {
puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
exit 1
}
- blame::new $head $path
+ blame::new $head $path $jump_spec
}
}
return
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 1be8145..a75685d 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -58,7 +58,7 @@ field tooltip_t {} ; # Text widget in $tooltip_wm
field tooltip_timer {} ; # Current timer event for our tooltip
field tooltip_commit {} ; # Commit(s) in tooltip
-constructor new {i_commit i_path} {
+constructor new {i_commit i_path i_jump} {
global cursor_ptr
variable active_color
variable group_colors
@@ -338,7 +338,7 @@ constructor new {i_commit i_path} {
wm protocol $top WM_DELETE_WINDOW "destroy $top"
bind $top <Destroy> [cb _kill]
- _load $this {}
+ _load $this $i_jump
}
method _kill {} {
diff --git a/lib/browser.tcl b/lib/browser.tcl
index ab470d1..0410cc6 100644
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
@@ -151,7 +151,7 @@ method _enter {} {
append p [lindex $n 1]
}
append p $name
- blame::new $browser_commit $p
+ blame::new $browser_commit $p {}
}
}
}
--
1.6.0.rc2
next prev parent reply other threads:[~2008-08-23 8:33 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 ` [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk Alexander Gavrilov
2008-08-26 10:27 ` 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 ` Alexander Gavrilov [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808231232.20592.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).