summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e681cb7)
raw | patch | inline | side by side (parent: e681cb7)
author | Alexander Gavrilov <angavrilov@gmail.com> | |
Sat, 23 Aug 2008 08:30:00 +0000 (12:30 +0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 25 Aug 2008 05:00:01 +0000 (22:00 -0700) |
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>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
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>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/blame.tcl | patch | blob | history | |
lib/option.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 8ad6567edd465bde71ad336042cf2ae4008ed86e..b0207ac36a7c905b909e764df9741b2d12432b96 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
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 b6e42cbc8fe0a49c301335f78cc2941bd9d59870..c8975cfecdbe5dd4cf00a458d5b07a6ff9840f8c 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
$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} {
}
}
-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 \
}
}
+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 ffb3f00ff0a992254804cc047b5a63ce82aa5bd9..eb958ffd47bf6b4be5b61a45191079dff99331a2 100644 (file)
--- a/lib/option.tcl
+++ b/lib/option.tcl
{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"}}