threads / patch / 15178

patch, 7 partsgitk: Allow overriding the default commit.

Subject: [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.

## tl;dr

12 messages between Aug 23, 2008 and Aug 26, 2008. Diffs are folded; open one to read it.

replies: 11people: 4as markdown or json

Alexander Gavrilov· Aug 23, 2008, 08:25 UTC · lore

[PATCH (GITK,GIT-GUI,DOCS) 0/7] Improve gui blame and gitk integration

This series improves git gui blame usability by providing better integration with gitk, and thus supporting more ways of navigating the history.

Viewing the history context is especially useful if the repository is imported from a VCS without atomic commits, and thus related changes are often fragmented into a sequence of several commit objects.

Note: Show History Context won't work if gitk is unpatched.
Usage scenario:
	1. Start git gui blame from an IDE macro; use
	   --line=... to immediately scroll to the same
	   position as the IDE editor.
	2. Use 'Show History Context' to view the diff
	   and surrounding commits.
	   
	3. Use 'Blame parent commit' in gitk to explore
	   blame for other files touched by the same commit.
	
	4. If the change is irrelevant (e.g. some variable
	   was renamed), close gitk and use 'Blame Parent Commit'
	   in Gui Blame to restart search.
GITK:
	gitk: Allow overriding the default commit.
	---
	 gitk |   21 ++++++++++++++++++++-
	 1 files changed, 20 insertions(+), 1 deletions(-)
 
	gitk: Support calling git gui blame from gitk.
	---
	 gitk |   23 +++++++++++++++++++++++
	 1 files changed, 23 insertions(+), 0 deletions(-)
 
GIT-GUI: 
	git-gui: Support starting gitk from Gui Blame
	---
	 git-gui.sh     |    1 +
	 lib/blame.tcl  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
	 lib/option.tcl |    1 +
	 3 files changed, 55 insertions(+), 2 deletions(-)
	 
	git-gui: Support passing blame to a parent commit.
	---
	 lib/blame.tcl |   48 ++++++++++++++++++++++++++++++++++++++----------
	 1 files changed, 38 insertions(+), 10 deletions(-)
	git-gui: Better positioning in Blame Parent Commit
	---
	 lib/blame.tcl |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
	 1 files changed, 61 insertions(+), 4 deletions(-)
	git-gui: Allow specifying an initial line for git gui blame.
	---
	 git-gui.sh      |   13 +++++++++++--
	 lib/blame.tcl   |    4 ++--
	 lib/browser.tcl |    2 +-
	 3 files changed, 14 insertions(+), 5 deletions(-)
DOCS:
	Document new options of gui tools.
	---
	 Documentation/config.txt  |   14 ++++++++++++++
	 Documentation/git-gui.txt |    5 +++++
	 Documentation/gitk.txt    |    5 +++++
	 3 files changed, 24 insertions(+), 0 deletions(-)
 
Alexander Gavrilov· Aug 23, 2008, 08:27 UTC · re: Alexander Gavrilov · lore

Other GUI tools may occasionally need to start gitk and make it automatically select a certain commit. This patch supports doing it using a new command-line option.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 gitk |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
Show changes to gitk +20 −1
diff --git a/gitk b/gitk
index 087c4ac..7698b70 100755
--- a/gitk
+++ b/gitk
@@ -418,10 +418,12 @@ proc stop_rev_list {view} {
 }
 
 proc reset_pending_select {selid} {
-    global pending_select mainheadid
+    global pending_select mainheadid selectheadid
 
     if {$selid ne {}} {
 	set pending_select $selid
+    } elseif {$selectheadid ne {}} {
+	set pending_select $selectheadid
     } else {
 	set pending_select $mainheadid
     }
@@ -1609,6 +1611,7 @@ proc getcommit {id} {
 proc readrefs {} {
     global tagids idtags headids idheads tagobjid
     global otherrefids idotherrefs mainhead mainheadid
+    global selecthead selectheadid
 
     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
 	catch {unset $v}
@@ -1655,6 +1658,12 @@ proc readrefs {} {
 	    set mainhead [string range $thehead 11 end]
 	}
     }
+    set selectheadid {}
+    if {$selecthead ne {}} {
+	catch {
+	    set selectheadid [exec git rev-parse --verify $selecthead]
+	}
+    }
 }
 
 # skip over fake commits
@@ -9865,6 +9874,9 @@ if {![file isdirectory $gitdir]} {
     exit 1
 }
 
+set selecthead {}
+set selectheadid {}
+
 set revtreeargs {}
 set cmdline_files {}
 set i 0
@@ -9876,6 +9888,9 @@ foreach arg $argv {
 	    set cmdline_files [lrange $argv [expr {$i + 1}] end]
 	    break
 	}
+	"--select-commit=*" {
+	    set selecthead [string range $arg 16 end]
+	}
 	"--argscmd=*" {
 	    set revtreeargscmd [string range $arg 10 end]
 	}
@@ -9886,6 +9901,10 @@ foreach arg $argv {
     incr i
 }
 
+if {$selecthead eq "HEAD"} {
+    set selecthead {}
+}
+
 if {$i >= [llength $argv] && $revtreeargs ne {}} {
     # no -- on command line, but some arguments (other than --argscmd)
     if {[catch {
-- 
1.6.0.rc2
Alexander Gavrilov· Aug 23, 2008, 08:29 UTC · re: Alexander Gavrilov · lore

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

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(-)
Show changes to gitk +23 −0
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
Paul Mackerras· Aug 26, 2008, 10:27 UTC · re: Alexander Gavrilov · lore

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

Alexander Gavrilov writes:
> 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.
Also applied, also with some edits to the description.
> +    $flist_menu add command -label [mc "Blame parent commit"] \
> +        -command {external_blame 1}
Why the parent commit rather than the current commit?
Paul.
Johannes Sixt· Aug 26, 2008, 12:10 UTC · re: Paul Mackerras · lore

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

Paul Mackerras schrieb:
Show 12 quoted lines
> Alexander Gavrilov writes:
> 
>> 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.
> 
> Also applied, also with some edits to the description.
> 
>> +    $flist_menu add command -label [mc "Blame parent commit"] \
>> +        -command {external_blame 1}
> 
> Why the parent commit rather than the current commit?

For the lines that the current commit *adds*, you know who is to blame (the current commit). Once you know that, you are usually interested in who is to blame for the lines that the current commit *removed*. To get this information, you must "Blame the parent commit".

-- Hannes
Paul Mackerras· Aug 26, 2008, 10:13 UTC · re: Alexander Gavrilov · lore

Re: [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.

Alexander Gavrilov writes:
> Other GUI tools may occasionally need to start
> gitk and make it automatically select a certain
> commit. This patch supports doing it using a new
> command-line option.
Thanks, applied, with some edits to the description.

Could you have used the existing pending_select for this? Was there a reason not to use it?

Paul.
Alexander Gavrilov· Aug 23, 2008, 08:30 UTC · re: Alexander Gavrilov · lore

[PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame

Add a context menu command to load commits that are within a certain time range from the selected commit into gitk.

It can be useful for understanding of the code, especially if the repository is imported from a VCS that does not support atomic commits.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 git-gui.sh     |    1 +
 lib/blame.tcl  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 lib/option.tcl |    1 +
 3 files changed, 55 insertions(+), 2 deletions(-)
Show changes to 3 files +55 −2

git-gui.sh, lib/blame.tcl, lib/option.tcl

diff --git a/git-gui.sh b/git-gui.sh
index ad65aaa..b8bbcd5 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -668,6 +668,7 @@ set default_config(gui.pruneduringfetch) false
 set default_config(gui.trustmtime) false
 set default_config(gui.fastcopyblame) false
 set default_config(gui.copyblamethreshold) 40
+set default_config(gui.blamehistoryctx) 7
 set default_config(gui.diffcontext) 5
 set default_config(gui.commitmsgwidth) 75
 set default_config(gui.newbranchtemplate) {}
diff --git a/lib/blame.tcl b/lib/blame.tcl
index b6e42cb..d6c56e8 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -259,6 +259,9 @@ constructor new {i_commit i_path} {
 	$w.ctxm add command \
 		-label [mc "Do Full Copy Detection"] \
 		-command [cb _fullcopyblame]
+	$w.ctxm add command \
+		-label [mc "Show History Context"] \
+		-command [cb _gitkcommit]
 
 	foreach i $w_columns {
 		for {set g 0} {$g < [llength $group_colors]} {incr g} {
@@ -905,10 +908,14 @@ method _showcommit {cur_w lno} {
 	}
 }
 
-method _copycommit {} {
+method _get_click_amov_info {} {
 	set pos @$::cursorX,$::cursorY
 	set lno [lindex [split [$::cursorW index $pos] .] 0]
-	set dat [lindex $amov_data $lno]
+	return [lindex $amov_data $lno]
+}
+
+method _copycommit {} {
+	set dat [_get_click_amov_info $this]
 	if {$dat ne {}} {
 		clipboard clear
 		clipboard append \
@@ -918,6 +925,50 @@ method _copycommit {} {
 	}
 }
 
+method _format_offset_date {base offset} {
+	set exval [expr {$base + $offset*24*60*60}]
+	return [clock format $exval -format {%Y-%m-%d}]
+}
+
+method _gitkcommit {} {
+	set dat [_get_click_amov_info $this]
+	if {$dat ne {}} {
+		set cmit [lindex $dat 0]
+		set radius [get_config gui.blamehistoryctx]
+		set cmdline [list --select-commit=$cmit]
+
+                if {$radius > 0} {
+			set author_time {}
+			set committer_time {}
+		
+			catch {set author_time $header($cmit,author-time)}
+			catch {set committer_time $header($cmit,committer-time)}
+
+			if {$committer_time eq {}} {
+				set committer_time $author_time
+			}
+
+			set after_time [_format_offset_date $this $committer_time [expr {-$radius}]]
+			set before_time [_format_offset_date $this $committer_time $radius]
+
+			lappend cmdline --after=$after_time --before=$before_time
+		}
+
+		lappend cmdline $cmit
+
+		set base_rev "HEAD"
+		if {$commit ne {}} {
+			set base_rev $commit
+		}
+
+		if {$base_rev ne $cmit} {
+			lappend cmdline $base_rev
+		}
+
+		do_gitk $cmdline
+	}
+}
+
 method _show_tooltip {cur_w pos} {
 	if {$tooltip_wm ne {}} {
 		_open_tooltip $this $cur_w
diff --git a/lib/option.tcl b/lib/option.tcl
index ffb3f00..eb958ff 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -125,6 +125,7 @@ proc do_options {} {
 		{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
 		{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
 		{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
+		{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
 		{i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
 		{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
 		{t gui.newbranchtemplate {mc "New Branch Name Template"}}
-- 
1.6.0.rc2
Alexander Gavrilov· Aug 23, 2008, 08:30 UTC · re: Alexander Gavrilov · lore

[PATCH (GITK,GIT-GUI,DOCS) 4/7] git-gui: Support passing blame to a parent commit.

Add a context menu item that switches the view to the parent of the commit under cursor. It is useful to see how the file looked before the change, and find older changes in the same lines.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 lib/blame.tcl |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)
Show changes to lib/blame.tcl +38 −10
diff --git a/lib/blame.tcl b/lib/blame.tcl
index d6c56e8..8b555a1 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -262,6 +262,9 @@ constructor new {i_commit i_path} {
 	$w.ctxm add command \
 		-label [mc "Show History Context"] \
 		-command [cb _gitkcommit]
+	$w.ctxm add command \
+		-label [mc "Blame Parent Commit"] \
+		-command [cb _blameparent]
 
 	foreach i $w_columns {
 		for {set g 0} {$g < [llength $group_colors]} {incr g} {
@@ -790,19 +793,27 @@ method _load_commit {cur_w cur_d pos} {
 	set lno [lindex [split [$cur_w index $pos] .] 0]
 	set dat [lindex $line_data $lno]
 	if {$dat ne {}} {
-		lappend history [list \
-			$commit $path \
-			$highlight_column \
-			$highlight_line \
-			[lindex [$w_file xview] 0] \
-			[lindex [$w_file yview] 0] \
-			]
-		set commit [lindex $dat 0]
-		set path   [lindex $dat 1]
-		_load $this [list [lindex $dat 2]]
+		_load_new_commit $this  \
+			[lindex $dat 0] \
+			[lindex $dat 1] \
+			[list [lindex $dat 2]]
 	}
 }
 
+method _load_new_commit {new_commit new_path jump} {
+	lappend history [list \
+		$commit $path \
+		$highlight_column \
+		$highlight_line \
+		[lindex [$w_file xview] 0] \
+		[lindex [$w_file yview] 0] \
+		]
+
+	set commit $new_commit
+	set path   $new_path
+	_load $this $jump
+}
+
 method _showcommit {cur_w lno} {
 	global repo_config
 	variable active_color
@@ -969,6 +980,23 @@ method _gitkcommit {} {
 	}
 }
 
+method _blameparent {} {
+	set dat [_get_click_amov_info $this]
+	if {$dat ne {}} {
+		set cmit [lindex $dat 0]
+
+		if {[catch {set cparent [git rev-parse --verify "$cmit^"]}]} {
+			error_popup [strcat [mc "Cannot find parent commit:"] "\n\n$err"]
+			return;
+		}
+
+		_load_new_commit $this  \
+			$cparent \
+			[lindex $dat 1] \
+			[list [lindex $dat 2]]
+	}
+}
+
 method _show_tooltip {cur_w pos} {
 	if {$tooltip_wm ne {}} {
 		_open_tooltip $this $cur_w
-- 
1.6.0.rc2
Alexander Gavrilov· Aug 23, 2008, 08:31 UTC · re: Alexander Gavrilov · lore

[PATCH (GITK,GIT-GUI,DOCS) 5/7] git-gui: Better positioning in Blame Parent Commit

Invoke diff-tree between the commit and its parent, and use the hunks to fix the target line number, accounting for addition and removal of lines.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 lib/blame.tcl |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 4 deletions(-)
Show changes to lib/blame.tcl +61 −4
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 8b555a1..1be8145 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -984,19 +984,76 @@ method _blameparent {} {
 	set dat [_get_click_amov_info $this]
 	if {$dat ne {}} {
 		set cmit [lindex $dat 0]
+		set new_path [lindex $dat 1]
 
 		if {[catch {set cparent [git rev-parse --verify "$cmit^"]}]} {
 			error_popup [strcat [mc "Cannot find parent commit:"] "\n\n$err"]
 			return;
 		}
 
-		_load_new_commit $this  \
-			$cparent \
-			[lindex $dat 1] \
-			[list [lindex $dat 2]]
+		_kill $this
+
+		# Generate a diff between the commit and its parent,
+		# and use the hunks to update the line number.
+		# Request zero context to simplify calculations.
+		if {[catch {set fd [eval git_read diff-tree \
+				--unified=0 $cparent $cmit $new_path]} err]} {
+			$status stop [mc "Unable to display parent"]
+			error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
+			return
+		}
+
+		set r_orig_line [lindex $dat 2]
+
+		fconfigure $fd \
+			-blocking 0 \
+			-encoding binary \
+			-translation binary
+		fileevent $fd readable [cb _read_diff_load_commit \
+			$fd $cparent $new_path $r_orig_line]
+		set current_fd $fd
 	}
 }
 
+method _read_diff_load_commit {fd cparent new_path tline} {
+	if {$fd ne $current_fd} {
+		catch {close $fd}
+		return
+	}
+
+	while {[gets $fd line] >= 0} {
+		if {[regexp {^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@} $line line \
+			old_line osz old_size new_line nsz new_size]} {
+
+			if {$osz eq {}} { set old_size 1 }
+			if {$nsz eq {}} { set new_size 1 }
+
+			if {$new_line <= $tline} {
+				if {[expr {$new_line + $new_size}] > $tline} {
+					# Target line within the hunk
+					set line_shift [expr {
+						($new_size-$old_size)*($tline-$new_line)/$new_size
+						}]
+				} else {
+					set line_shift [expr {$new_size-$old_size}]
+				}
+
+				set r_orig_line [expr {$r_orig_line - $line_shift}]
+			}
+		}
+	}
+
+	if {[eof $fd]} {
+		close $fd;
+		set current_fd {}
+
+		_load_new_commit $this  \
+			$cparent        \
+			$new_path       \
+			[list $r_orig_line]
+	}
+} ifdeleted { catch {close $fd} }
+
 method _show_tooltip {cur_w pos} {
 	if {$tooltip_wm ne {}} {
 		_open_tooltip $this $cur_w
-- 
1.6.0.rc2
Alexander Gavrilov· Aug 23, 2008, 08:32 UTC · re: Alexander Gavrilov · lore

[PATCH (GITK,GIT-GUI,DOCS) 6/7] git-gui: Allow specifying an initial line for git gui blame.

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(-)
Show changes to 3 files +14 −5

git-gui.sh, lib/blame.tcl, lib/browser.tcl

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
Shawn O. Pearce· Aug 25, 2008, 05:06 UTC · re: Alexander Gavrilov · lore

Re: [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame

Alexander Gavrilov <angavrilov@gmail.com> wrote:
Show 7 quoted lines
> Add a context menu command to load commits
> that are within a certain time range from the
> selected commit into gitk.
> 
> It can be useful for understanding of the code,
> especially if the repository is imported from
> a VCS that does not support atomic commits.

The git-gui part of this series is now staged in my pu branch. If Paul is going to also apply this to gitk we can ship it in the next feature release of Git (1.6.1).

-- 
Shawn.
Alexander Gavrilov· Aug 23, 2008, 08:33 UTC · re: Alexander Gavrilov · lore

[PATCH (GITK,GIT-GUI,DOCS) 7/7] Document new options of gui tools.

Adds information on git-gui configuration, and new git-gui blame & gitk command-line options.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 Documentation/config.txt  |   14 ++++++++++++++
 Documentation/git-gui.txt |    5 +++++
 Documentation/gitk.txt    |    5 +++++
 3 files changed, 24 insertions(+), 0 deletions(-)
Show changes to 3 files +24 −0

Documentation/config.txt, Documentation/git-gui.txt, Documentation/gitk.txt

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 676c39b..47bffea 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -772,6 +772,20 @@ gui.spellingdictionary::
 	the linkgit:git-gui[1]. When set to "none" spell checking is turned
 	off.
 
+gui.fastcopyblame::
+	If true, 'git gui blame' uses '-C' instead of '-C -C' for original location
+	detection. It makes blame significantly more usable on huge repositories.
+
+gui.copyblamethreshold::
+	Specifies the theshold to use in 'git gui blame' original location detection,
+	measured in alphanumeric characters. See the linkgit:git-blame[1] manual
+	for more information on copy detection.
+
+gui.blamehistoryctx::
+	Specifies the radius of history context (in days) to show in gitk for
+	the selected commit when the corresponding context menu item is invoked.
+	If this parameter is zero, all history is shown.
+
 help.browser::
 	Specify the browser that will be used to display help in the
 	'web' format. See linkgit:git-help[1].
diff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt
index 0e650f4..39bdded 100644
--- a/Documentation/git-gui.txt
+++ b/Documentation/git-gui.txt
@@ -65,6 +65,11 @@ git gui blame v0.99.8 Makefile::
 	example the file is read from the object database and not
 	the working directory.
 
+git gui blame --line=100 Makefile::
+
+	Loads annotations as described above and automatically
+	scrolls the view to center on line 100.
+
 git gui citool::
 
 	Make one commit and return to the shell when it is complete.
diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt
index 6e827cd..8650809 100644
--- a/Documentation/gitk.txt
+++ b/Documentation/gitk.txt
@@ -49,6 +49,11 @@ frequently used options.
 	the history between two branches (i.e. the HEAD and the MERGE_HEAD)
 	that modify the conflicted files.
 
+--select-commit=<ref>::
+
+	Automatically select the specified commit after loading the graph.
+	Default behavior is equivalent to specifying '--select-commit=HEAD'.
+
 <revs>::
 
 	Limit the revisions to show. This can be either a single revision
-- 
1.6.0.rc2

← back to recent threads