summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 823f7cf)
raw | patch | inline | side by side (parent: 823f7cf)
author | Alexander Gavrilov <angavrilov@gmail.com> | |
Sat, 23 Aug 2008 08:32:20 +0000 (12:32 +0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 25 Aug 2008 05:00:01 +0000 (22:00 -0700) |
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>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
scroll to a specific line in the file. Useful for integration
with other tools.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/blame.tcl | patch | blob | history | |
lib/browser.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index b0207ac36a7c905b909e764df9741b2d12432b96..ec08b5a921ed8ebc17714b5f2e96682b68d0d6bd 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
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]} {
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
switch -- $subcommand {
browser {
+ if {$jump_spec ne {}} usage
if {$head eq {}} {
if {$path ne {} && [file isdirectory $path]} {
set head $current_branch
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 1106975775e86cea028b42977521ea255d698468..827c85d67f0b0f18d22b1399624e6819cf93f23f 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
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
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 ab470d12648c1dd3560b411e70ea210cc4381e3e..0410cc68df186d6e8e0080058be94126243fd4d3 100644 (file)
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
append p [lindex $n 1]
}
append p $name
- blame::new $browser_commit $p
+ blame::new $browser_commit $p {}
}
}
}