{"thread":{"id":"15178","subject":"[PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.","startedAt":"2008-08-23T08:25:11Z","lastAt":"2008-08-26T12:10:33Z","messageCount":12,"participants":["Alexander Gavrilov","Shawn O. Pearce","Paul Mackerras","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"88272","messageId":"200808231225.12596.angavrilov@gmail.com","threadId":"15178","inReplyTo":null,"subject":"[PATCH (GITK,GIT-GUI,DOCS) 0/7] Improve gui blame and gitk integration","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:25:11Z","receivedAt":"2008-08-23T08:25:11Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"This series improves git gui blame usability by providing\nbetter integration with gitk, and thus supporting more ways\nof navigating the history.\n\nViewing the history context is especially useful if the\nrepository is imported from a VCS without atomic commits,\nand thus related changes are often fragmented into a sequence\nof several commit objects.\n\nNote: Show History Context won't work if gitk is unpatched.\n\n\nUsage scenario:\n\n\t1. Start git gui blame from an IDE macro; use\n\t   --line=... to immediately scroll to the same\n\t   position as the IDE editor.\n\n\t2. Use 'Show History Context' to view the diff\n\t   and surrounding commits.\n\t   \n\t3. Use 'Blame parent commit' in gitk to explore\n\t   blame for other files touched by the same commit.\n\t\n\t4. If the change is irrelevant (e.g. some variable\n\t   was renamed), close gitk and use 'Blame Parent Commit'\n\t   in Gui Blame to restart search.\n\n\nGITK:\n\tgitk: Allow overriding the default commit.\n\t---\n\t gitk |   21 ++++++++++++++++++++-\n\t 1 files changed, 20 insertions(+), 1 deletions(-)\n \n\tgitk: Support calling git gui blame from gitk.\n\t---\n\t gitk |   23 +++++++++++++++++++++++\n\t 1 files changed, 23 insertions(+), 0 deletions(-)\n \nGIT-GUI: \n\tgit-gui: Support starting gitk from Gui Blame\n\t---\n\t git-gui.sh     |    1 +\n\t lib/blame.tcl  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--\n\t lib/option.tcl |    1 +\n\t 3 files changed, 55 insertions(+), 2 deletions(-)\n\t \n\tgit-gui: Support passing blame to a parent commit.\n\t---\n\t lib/blame.tcl |   48 ++++++++++++++++++++++++++++++++++++++----------\n\t 1 files changed, 38 insertions(+), 10 deletions(-)\n\n\tgit-gui: Better positioning in Blame Parent Commit\n\t---\n\t lib/blame.tcl |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++---\n\t 1 files changed, 61 insertions(+), 4 deletions(-)\n\n\tgit-gui: Allow specifying an initial line for git gui blame.\n\t---\n\t git-gui.sh      |   13 +++++++++++--\n\t lib/blame.tcl   |    4 ++--\n\t lib/browser.tcl |    2 +-\n\t 3 files changed, 14 insertions(+), 5 deletions(-)\n\nDOCS:\n\tDocument new options of gui tools.\n\t---\n\t Documentation/config.txt  |   14 ++++++++++++++\n\t Documentation/git-gui.txt |    5 +++++\n\t Documentation/gitk.txt    |    5 +++++\n\t 3 files changed, 24 insertions(+), 0 deletions(-)\n \n"},{"id":"88265","messageId":"200808231227.45013.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231225.12596.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:27:44Z","receivedAt":"2008-08-23T08:27:44Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Other GUI tools may occasionally need to start\ngitk and make it automatically select a certain\ncommit. This patch supports doing it using a new\ncommand-line option.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n gitk |   21 ++++++++++++++++++++-\n 1 files changed, 20 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 087c4ac..7698b70 100755\n--- a/gitk\n+++ b/gitk\n@@ -418,10 +418,12 @@ proc stop_rev_list {view} {\n }\n \n proc reset_pending_select {selid} {\n-    global pending_select mainheadid\n+    global pending_select mainheadid selectheadid\n \n     if {$selid ne {}} {\n \tset pending_select $selid\n+    } elseif {$selectheadid ne {}} {\n+\tset pending_select $selectheadid\n     } else {\n \tset pending_select $mainheadid\n     }\n@@ -1609,6 +1611,7 @@ proc getcommit {id} {\n proc readrefs {} {\n     global tagids idtags headids idheads tagobjid\n     global otherrefids idotherrefs mainhead mainheadid\n+    global selecthead selectheadid\n \n     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {\n \tcatch {unset $v}\n@@ -1655,6 +1658,12 @@ proc readrefs {} {\n \t    set mainhead [string range $thehead 11 end]\n \t}\n     }\n+    set selectheadid {}\n+    if {$selecthead ne {}} {\n+\tcatch {\n+\t    set selectheadid [exec git rev-parse --verify $selecthead]\n+\t}\n+    }\n }\n \n # skip over fake commits\n@@ -9865,6 +9874,9 @@ if {![file isdirectory $gitdir]} {\n     exit 1\n }\n \n+set selecthead {}\n+set selectheadid {}\n+\n set revtreeargs {}\n set cmdline_files {}\n set i 0\n@@ -9876,6 +9888,9 @@ foreach arg $argv {\n \t    set cmdline_files [lrange $argv [expr {$i + 1}] end]\n \t    break\n \t}\n+\t\"--select-commit=*\" {\n+\t    set selecthead [string range $arg 16 end]\n+\t}\n \t\"--argscmd=*\" {\n \t    set revtreeargscmd [string range $arg 10 end]\n \t}\n@@ -9886,6 +9901,10 @@ foreach arg $argv {\n     incr i\n }\n \n+if {$selecthead eq \"HEAD\"} {\n+    set selecthead {}\n+}\n+\n if {$i >= [llength $argv] && $revtreeargs ne {}} {\n     # no -- on command line, but some arguments (other than --argscmd)\n     if {[catch {\n-- \n1.6.0.rc2\n"},{"id":"88267","messageId":"200808231229.09191.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231227.45013.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:29:08Z","receivedAt":"2008-08-23T08:29:08Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Add a new item to the file list popup menu, that\ncalls git gui blame for the selected file, starting\nwith the first parent of the current commit.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n gitk |   23 +++++++++++++++++++++++\n 1 files changed, 23 insertions(+), 0 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 7698b70..2eaa2ae 100755\n--- a/gitk\n+++ b/gitk\n@@ -2214,6 +2214,8 @@ proc makewindow {} {\n \t-command {flist_hl 1}\n     $flist_menu add command -label [mc \"External diff\"] \\\n         -command {external_diff}\n+    $flist_menu add command -label [mc \"Blame parent commit\"] \\\n+        -command {external_blame 1}\n }\n \n # Windows sends all mouse wheel events to the current focused window, not\n@@ -3021,6 +3023,27 @@ proc external_diff {} {\n     }\n }\n \n+proc external_blame {parent_idx} {\n+    global flist_menu_file\n+    global nullid nullid2\n+    global parentlist selectedline currentid\n+\n+    if {$parent_idx > 0} {\n+\tset base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]\n+    } else {\n+\tset base_commit $currentid\n+    }\n+\n+    if {$base_commit eq {} || $base_commit eq $nullid || $base_commit eq $nullid2} {\n+\terror_popup [mc \"No such commit\"]\n+\treturn\n+    }\n+\n+    if {[catch {exec git gui blame $base_commit $flist_menu_file &} err]} {\n+\terror_popup [mc \"git gui blame: command failed: $err\"]\n+    }\n+}\n+\n # delete $dir when we see eof on $f (presumably because the child has exited)\n proc delete_at_eof {f dir} {\n     while {[gets $f line] >= 0} {}\n-- \n1.6.0.rc2\n"},{"id":"88268","messageId":"200808231230.00397.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231225.12596.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:30:00Z","receivedAt":"2008-08-23T08:30:00Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Add a context menu command to load commits\nthat are within a certain time range from the\nselected commit into gitk.\n\nIt can be useful for understanding of the code,\nespecially if the repository is imported from\na VCS that does not support atomic commits.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n git-gui.sh     |    1 +\n lib/blame.tcl  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--\n lib/option.tcl |    1 +\n 3 files changed, 55 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex ad65aaa..b8bbcd5 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -668,6 +668,7 @@ set default_config(gui.pruneduringfetch) false\n set default_config(gui.trustmtime) false\n set default_config(gui.fastcopyblame) false\n set default_config(gui.copyblamethreshold) 40\n+set default_config(gui.blamehistoryctx) 7\n set default_config(gui.diffcontext) 5\n set default_config(gui.commitmsgwidth) 75\n set default_config(gui.newbranchtemplate) {}\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex b6e42cb..d6c56e8 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -259,6 +259,9 @@ constructor new {i_commit i_path} {\n \t$w.ctxm add command \\\n \t\t-label [mc \"Do Full Copy Detection\"] \\\n \t\t-command [cb _fullcopyblame]\n+\t$w.ctxm add command \\\n+\t\t-label [mc \"Show History Context\"] \\\n+\t\t-command [cb _gitkcommit]\n \n \tforeach i $w_columns {\n \t\tfor {set g 0} {$g < [llength $group_colors]} {incr g} {\n@@ -905,10 +908,14 @@ method _showcommit {cur_w lno} {\n \t}\n }\n \n-method _copycommit {} {\n+method _get_click_amov_info {} {\n \tset pos @$::cursorX,$::cursorY\n \tset lno [lindex [split [$::cursorW index $pos] .] 0]\n-\tset dat [lindex $amov_data $lno]\n+\treturn [lindex $amov_data $lno]\n+}\n+\n+method _copycommit {} {\n+\tset dat [_get_click_amov_info $this]\n \tif {$dat ne {}} {\n \t\tclipboard clear\n \t\tclipboard append \\\n@@ -918,6 +925,50 @@ method _copycommit {} {\n \t}\n }\n \n+method _format_offset_date {base offset} {\n+\tset exval [expr {$base + $offset*24*60*60}]\n+\treturn [clock format $exval -format {%Y-%m-%d}]\n+}\n+\n+method _gitkcommit {} {\n+\tset dat [_get_click_amov_info $this]\n+\tif {$dat ne {}} {\n+\t\tset cmit [lindex $dat 0]\n+\t\tset radius [get_config gui.blamehistoryctx]\n+\t\tset cmdline [list --select-commit=$cmit]\n+\n+                if {$radius > 0} {\n+\t\t\tset author_time {}\n+\t\t\tset committer_time {}\n+\t\t\n+\t\t\tcatch {set author_time $header($cmit,author-time)}\n+\t\t\tcatch {set committer_time $header($cmit,committer-time)}\n+\n+\t\t\tif {$committer_time eq {}} {\n+\t\t\t\tset committer_time $author_time\n+\t\t\t}\n+\n+\t\t\tset after_time [_format_offset_date $this $committer_time [expr {-$radius}]]\n+\t\t\tset before_time [_format_offset_date $this $committer_time $radius]\n+\n+\t\t\tlappend cmdline --after=$after_time --before=$before_time\n+\t\t}\n+\n+\t\tlappend cmdline $cmit\n+\n+\t\tset base_rev \"HEAD\"\n+\t\tif {$commit ne {}} {\n+\t\t\tset base_rev $commit\n+\t\t}\n+\n+\t\tif {$base_rev ne $cmit} {\n+\t\t\tlappend cmdline $base_rev\n+\t\t}\n+\n+\t\tdo_gitk $cmdline\n+\t}\n+}\n+\n method _show_tooltip {cur_w pos} {\n \tif {$tooltip_wm ne {}} {\n \t\t_open_tooltip $this $cur_w\ndiff --git a/lib/option.tcl b/lib/option.tcl\nindex ffb3f00..eb958ff 100644\n--- a/lib/option.tcl\n+++ b/lib/option.tcl\n@@ -125,6 +125,7 @@ proc do_options {} {\n \t\t{b gui.matchtrackingbranch {mc \"Match Tracking Branches\"}}\n \t\t{b gui.fastcopyblame {mc \"Blame Copy Only On Changed Files\"}}\n \t\t{i-20..200 gui.copyblamethreshold {mc \"Minimum Letters To Blame Copy On\"}}\n+\t\t{i-0..300 gui.blamehistoryctx {mc \"Blame History Context Radius (days)\"}}\n \t\t{i-0..99 gui.diffcontext {mc \"Number of Diff Context Lines\"}}\n \t\t{i-0..99 gui.commitmsgwidth {mc \"Commit Message Text Width\"}}\n \t\t{t gui.newbranchtemplate {mc \"New Branch Name Template\"}}\n-- \n1.6.0.rc2\n"},{"id":"88269","messageId":"200808231230.51693.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231230.00397.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 4/7] git-gui: Support passing blame to a parent commit.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:30:51Z","receivedAt":"2008-08-23T08:30:51Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Add a context menu item that switches the view to the\nparent of the commit under cursor. It is useful to see\nhow the file looked before the change, and find older\nchanges in the same lines.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n lib/blame.tcl |   48 ++++++++++++++++++++++++++++++++++++++----------\n 1 files changed, 38 insertions(+), 10 deletions(-)\n\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex d6c56e8..8b555a1 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -262,6 +262,9 @@ constructor new {i_commit i_path} {\n \t$w.ctxm add command \\\n \t\t-label [mc \"Show History Context\"] \\\n \t\t-command [cb _gitkcommit]\n+\t$w.ctxm add command \\\n+\t\t-label [mc \"Blame Parent Commit\"] \\\n+\t\t-command [cb _blameparent]\n \n \tforeach i $w_columns {\n \t\tfor {set g 0} {$g < [llength $group_colors]} {incr g} {\n@@ -790,19 +793,27 @@ method _load_commit {cur_w cur_d pos} {\n \tset lno [lindex [split [$cur_w index $pos] .] 0]\n \tset dat [lindex $line_data $lno]\n \tif {$dat ne {}} {\n-\t\tlappend history [list \\\n-\t\t\t$commit $path \\\n-\t\t\t$highlight_column \\\n-\t\t\t$highlight_line \\\n-\t\t\t[lindex [$w_file xview] 0] \\\n-\t\t\t[lindex [$w_file yview] 0] \\\n-\t\t\t]\n-\t\tset commit [lindex $dat 0]\n-\t\tset path   [lindex $dat 1]\n-\t\t_load $this [list [lindex $dat 2]]\n+\t\t_load_new_commit $this  \\\n+\t\t\t[lindex $dat 0] \\\n+\t\t\t[lindex $dat 1] \\\n+\t\t\t[list [lindex $dat 2]]\n \t}\n }\n \n+method _load_new_commit {new_commit new_path jump} {\n+\tlappend history [list \\\n+\t\t$commit $path \\\n+\t\t$highlight_column \\\n+\t\t$highlight_line \\\n+\t\t[lindex [$w_file xview] 0] \\\n+\t\t[lindex [$w_file yview] 0] \\\n+\t\t]\n+\n+\tset commit $new_commit\n+\tset path   $new_path\n+\t_load $this $jump\n+}\n+\n method _showcommit {cur_w lno} {\n \tglobal repo_config\n \tvariable active_color\n@@ -969,6 +980,23 @@ method _gitkcommit {} {\n \t}\n }\n \n+method _blameparent {} {\n+\tset dat [_get_click_amov_info $this]\n+\tif {$dat ne {}} {\n+\t\tset cmit [lindex $dat 0]\n+\n+\t\tif {[catch {set cparent [git rev-parse --verify \"$cmit^\"]}]} {\n+\t\t\terror_popup [strcat [mc \"Cannot find parent commit:\"] \"\\n\\n$err\"]\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t_load_new_commit $this  \\\n+\t\t\t$cparent \\\n+\t\t\t[lindex $dat 1] \\\n+\t\t\t[list [lindex $dat 2]]\n+\t}\n+}\n+\n method _show_tooltip {cur_w pos} {\n \tif {$tooltip_wm ne {}} {\n \t\t_open_tooltip $this $cur_w\n-- \n1.6.0.rc2\n"},{"id":"88270","messageId":"200808231231.35635.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231230.51693.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 5/7] git-gui: Better positioning in Blame Parent Commit","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:31:35Z","receivedAt":"2008-08-23T08:31:35Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Invoke diff-tree between the commit and its parent,\nand use the hunks to fix the target line number,\naccounting for addition and removal of lines.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n lib/blame.tcl |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 61 insertions(+), 4 deletions(-)\n\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex 8b555a1..1be8145 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -984,19 +984,76 @@ method _blameparent {} {\n \tset dat [_get_click_amov_info $this]\n \tif {$dat ne {}} {\n \t\tset cmit [lindex $dat 0]\n+\t\tset new_path [lindex $dat 1]\n \n \t\tif {[catch {set cparent [git rev-parse --verify \"$cmit^\"]}]} {\n \t\t\terror_popup [strcat [mc \"Cannot find parent commit:\"] \"\\n\\n$err\"]\n \t\t\treturn;\n \t\t}\n \n-\t\t_load_new_commit $this  \\\n-\t\t\t$cparent \\\n-\t\t\t[lindex $dat 1] \\\n-\t\t\t[list [lindex $dat 2]]\n+\t\t_kill $this\n+\n+\t\t# Generate a diff between the commit and its parent,\n+\t\t# and use the hunks to update the line number.\n+\t\t# Request zero context to simplify calculations.\n+\t\tif {[catch {set fd [eval git_read diff-tree \\\n+\t\t\t\t--unified=0 $cparent $cmit $new_path]} err]} {\n+\t\t\t$status stop [mc \"Unable to display parent\"]\n+\t\t\terror_popup [strcat [mc \"Error loading diff:\"] \"\\n\\n$err\"]\n+\t\t\treturn\n+\t\t}\n+\n+\t\tset r_orig_line [lindex $dat 2]\n+\n+\t\tfconfigure $fd \\\n+\t\t\t-blocking 0 \\\n+\t\t\t-encoding binary \\\n+\t\t\t-translation binary\n+\t\tfileevent $fd readable [cb _read_diff_load_commit \\\n+\t\t\t$fd $cparent $new_path $r_orig_line]\n+\t\tset current_fd $fd\n \t}\n }\n \n+method _read_diff_load_commit {fd cparent new_path tline} {\n+\tif {$fd ne $current_fd} {\n+\t\tcatch {close $fd}\n+\t\treturn\n+\t}\n+\n+\twhile {[gets $fd line] >= 0} {\n+\t\tif {[regexp {^@@ -(\\d+)(,(\\d+))? \\+(\\d+)(,(\\d+))? @@} $line line \\\n+\t\t\told_line osz old_size new_line nsz new_size]} {\n+\n+\t\t\tif {$osz eq {}} { set old_size 1 }\n+\t\t\tif {$nsz eq {}} { set new_size 1 }\n+\n+\t\t\tif {$new_line <= $tline} {\n+\t\t\t\tif {[expr {$new_line + $new_size}] > $tline} {\n+\t\t\t\t\t# Target line within the hunk\n+\t\t\t\t\tset line_shift [expr {\n+\t\t\t\t\t\t($new_size-$old_size)*($tline-$new_line)/$new_size\n+\t\t\t\t\t\t}]\n+\t\t\t\t} else {\n+\t\t\t\t\tset line_shift [expr {$new_size-$old_size}]\n+\t\t\t\t}\n+\n+\t\t\t\tset r_orig_line [expr {$r_orig_line - $line_shift}]\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tif {[eof $fd]} {\n+\t\tclose $fd;\n+\t\tset current_fd {}\n+\n+\t\t_load_new_commit $this  \\\n+\t\t\t$cparent        \\\n+\t\t\t$new_path       \\\n+\t\t\t[list $r_orig_line]\n+\t}\n+} ifdeleted { catch {close $fd} }\n+\n method _show_tooltip {cur_w pos} {\n \tif {$tooltip_wm ne {}} {\n \t\t_open_tooltip $this $cur_w\n-- \n1.6.0.rc2\n"},{"id":"88271","messageId":"200808231232.20592.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231231.35635.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 6/7] git-gui: Allow specifying an initial line for git gui blame.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:32:20Z","receivedAt":"2008-08-23T08:32:20Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Add a command-line option to make git gui blame automatically\nscroll to a specific line in the file. Useful for integration\nwith other tools.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n git-gui.sh      |   13 +++++++++++--\n lib/blame.tcl   |    4 ++--\n lib/browser.tcl |    2 +-\n 3 files changed, 14 insertions(+), 5 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex b8bbcd5..e5ea9a8 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2282,10 +2282,15 @@ proc usage {} {\n switch -- $subcommand {\n browser -\n blame {\n-\tset subcommand_args {rev? path}\n+\tif {$subcommand eq \"blame\"} {\n+\t\tset subcommand_args {[--line=<num>] rev? path}\n+\t} else {\n+\t\tset subcommand_args {rev? path}\n+\t}\n \tif {$argv eq {}} usage\n \tset head {}\n \tset path {}\n+\tset jump_spec {}\n \tset is_path 0\n \tforeach a $argv {\n \t\tif {$is_path || [file exists $_prefix$a]} {\n@@ -2299,6 +2304,9 @@ blame {\n \t\t\t\tset path {}\n \t\t\t}\n \t\t\tset is_path 1\n+\t\t} elseif {[regexp {^--line=(\\d+)$} $a a lnum]} {\n+\t\t\tif {$jump_spec ne {} || $head ne {}} usage\n+\t\t\tset jump_spec [list $lnum]\n \t\t} elseif {$head eq {}} {\n \t\t\tif {$head ne {}} usage\n \t\t\tset head $a\n@@ -2330,6 +2338,7 @@ blame {\n \n \tswitch -- $subcommand {\n \tbrowser {\n+\t\tif {$jump_spec ne {}} usage\n \t\tif {$head eq {}} {\n \t\t\tif {$path ne {} && [file isdirectory $path]} {\n \t\t\t\tset head $current_branch\n@@ -2345,7 +2354,7 @@ blame {\n \t\t\tputs stderr [mc \"fatal: cannot stat path %s: No such file or directory\" $path]\n \t\t\texit 1\n \t\t}\n-\t\tblame::new $head $path\n+\t\tblame::new $head $path $jump_spec\n \t}\n \t}\n \treturn\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex 1be8145..a75685d 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -58,7 +58,7 @@ field tooltip_t         {} ; # Text widget in $tooltip_wm\n field tooltip_timer     {} ; # Current timer event for our tooltip\n field tooltip_commit    {} ; # Commit(s) in tooltip\n \n-constructor new {i_commit i_path} {\n+constructor new {i_commit i_path i_jump} {\n \tglobal cursor_ptr\n \tvariable active_color\n \tvariable group_colors\n@@ -338,7 +338,7 @@ constructor new {i_commit i_path} {\n \twm protocol $top WM_DELETE_WINDOW \"destroy $top\"\n \tbind $top <Destroy> [cb _kill]\n \n-\t_load $this {}\n+\t_load $this $i_jump\n }\n \n method _kill {} {\ndiff --git a/lib/browser.tcl b/lib/browser.tcl\nindex ab470d1..0410cc6 100644\n--- a/lib/browser.tcl\n+++ b/lib/browser.tcl\n@@ -151,7 +151,7 @@ method _enter {} {\n \t\t\t\tappend p [lindex $n 1]\n \t\t\t}\n \t\t\tappend p $name\n-\t\t\tblame::new $browser_commit $p\n+\t\t\tblame::new $browser_commit $p {}\n \t\t}\n \t\t}\n \t}\n-- \n1.6.0.rc2\n"},{"id":"88273","messageId":"200808231233.02019.angavrilov@gmail.com","threadId":"15178","inReplyTo":"200808231225.12596.angavrilov@gmail.com","subject":"[PATCH (GITK,GIT-GUI,DOCS) 7/7] Document new options of gui tools.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-08-23T08:33:01Z","receivedAt":"2008-08-23T08:33:01Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Adds information on git-gui configuration, and new\ngit-gui blame & gitk command-line options.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n Documentation/config.txt  |   14 ++++++++++++++\n Documentation/git-gui.txt |    5 +++++\n Documentation/gitk.txt    |    5 +++++\n 3 files changed, 24 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 676c39b..47bffea 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -772,6 +772,20 @@ gui.spellingdictionary::\n \tthe linkgit:git-gui[1]. When set to \"none\" spell checking is turned\n \toff.\n \n+gui.fastcopyblame::\n+\tIf true, 'git gui blame' uses '-C' instead of '-C -C' for original location\n+\tdetection. It makes blame significantly more usable on huge repositories.\n+\n+gui.copyblamethreshold::\n+\tSpecifies the theshold to use in 'git gui blame' original location detection,\n+\tmeasured in alphanumeric characters. See the linkgit:git-blame[1] manual\n+\tfor more information on copy detection.\n+\n+gui.blamehistoryctx::\n+\tSpecifies the radius of history context (in days) to show in gitk for\n+\tthe selected commit when the corresponding context menu item is invoked.\n+\tIf this parameter is zero, all history is shown.\n+\n help.browser::\n \tSpecify the browser that will be used to display help in the\n \t'web' format. See linkgit:git-help[1].\ndiff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt\nindex 0e650f4..39bdded 100644\n--- a/Documentation/git-gui.txt\n+++ b/Documentation/git-gui.txt\n@@ -65,6 +65,11 @@ git gui blame v0.99.8 Makefile::\n \texample the file is read from the object database and not\n \tthe working directory.\n \n+git gui blame --line=100 Makefile::\n+\n+\tLoads annotations as described above and automatically\n+\tscrolls the view to center on line 100.\n+\n git gui citool::\n \n \tMake one commit and return to the shell when it is complete.\ndiff --git a/Documentation/gitk.txt b/Documentation/gitk.txt\nindex 6e827cd..8650809 100644\n--- a/Documentation/gitk.txt\n+++ b/Documentation/gitk.txt\n@@ -49,6 +49,11 @@ frequently used options.\n \tthe history between two branches (i.e. the HEAD and the MERGE_HEAD)\n \tthat modify the conflicted files.\n \n+--select-commit=<ref>::\n+\n+\tAutomatically select the specified commit after loading the graph.\n+\tDefault behavior is equivalent to specifying '--select-commit=HEAD'.\n+\n <revs>::\n \n \tLimit the revisions to show. This can be either a single revision\n-- \n1.6.0.rc2\n"},{"id":"88427","messageId":"20080825050614.GC19127@spearce.org","threadId":"15178","inReplyTo":"200808231230.00397.angavrilov@gmail.com","subject":"Re: [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-25T05:06:14Z","receivedAt":"2008-08-25T05:06:14Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Alexander Gavrilov <angavrilov@gmail.com> wrote:\n> Add a context menu command to load commits\n> that are within a certain time range from the\n> selected commit into gitk.\n> \n> It can be useful for understanding of the code,\n> especially if the repository is imported from\n> a VCS that does not support atomic commits.\n\nThe git-gui part of this series is now staged in my pu branch.\nIf Paul is going to also apply this to gitk we can ship it in\nthe next feature release of Git (1.6.1).\n\n-- \nShawn.\n"},{"id":"88566","messageId":"18611.55100.873867.377208@cargo.ozlabs.ibm.com","threadId":"15178","inReplyTo":"200808231227.45013.angavrilov@gmail.com","subject":"Re: [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-08-26T10:13:16Z","receivedAt":"2008-08-26T10:13:16Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Alexander Gavrilov writes:\n\n> Other GUI tools may occasionally need to start\n> gitk and make it automatically select a certain\n> commit. This patch supports doing it using a new\n> command-line option.\n\nThanks, applied, with some edits to the description.\n\nCould you have used the existing pending_select for this?  Was there a\nreason not to use it?\n\nPaul.\n"},{"id":"88567","messageId":"18611.55963.306938.896762@cargo.ozlabs.ibm.com","threadId":"15178","inReplyTo":"200808231229.09191.angavrilov@gmail.com","subject":"Re: [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk.","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-08-26T10:27:39Z","receivedAt":"2008-08-26T10:27:39Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Alexander Gavrilov writes:\n\n> Add a new item to the file list popup menu, that\n> calls git gui blame for the selected file, starting\n> with the first parent of the current commit.\n\nAlso applied, also with some edits to the description.\n\n> +    $flist_menu add command -label [mc \"Blame parent commit\"] \\\n> +        -command {external_blame 1}\n\nWhy the parent commit rather than the current commit?\n\nPaul.\n"},{"id":"88571","messageId":"48B3F2B9.4030403@viscovery.net","threadId":"15178","inReplyTo":"18611.55963.306938.896762@cargo.ozlabs.ibm.com","subject":"Re: [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk.","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-08-26T12:10:33Z","receivedAt":"2008-08-26T12:10:33Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Paul Mackerras schrieb:\n> Alexander Gavrilov writes:\n> \n>> Add a new item to the file list popup menu, that\n>> calls git gui blame for the selected file, starting\n>> with the first parent of the current commit.\n> \n> Also applied, also with some edits to the description.\n> \n>> +    $flist_menu add command -label [mc \"Blame parent commit\"] \\\n>> +        -command {external_blame 1}\n> \n> Why the parent commit rather than the current commit?\n\nFor the lines that the current commit *adds*, you know who is to blame\n(the current commit). Once you know that, you are usually interested in\nwho is to blame for the lines that the current commit *removed*. To get\nthis information, you must \"Blame the parent commit\".\n\n-- Hannes\n"}]}