proc start_rev_list {view} {
global startmsecs
global commfd leftover tclencoding datemode
- global viewargs viewfiles commitidx viewcomplete vnextroot
+ global viewargs viewargscmd viewfiles commitidx viewcomplete vnextroot
global showlocalchanges commitinterest mainheadid
global progressdirn progresscoords proglastnc curview
set commitidx($view) 0
set viewcomplete($view) 0
set vnextroot($view) 0
+ set args $viewargs($view)
+ if {$viewargscmd($view) ne {}} {
+ if {[catch {
+ set str [exec sh -c $viewargscmd($view)]
+ } err]} {
+ error_popup "Error executing --argscmd command: $err"
+ exit 1
+ }
+ set args [concat $args [split $str "\n"]]
+ }
set order "--topo-order"
if {$datemode} {
set order "--date-order"
}
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw $order --parents \
- --boundary $viewargs($view) "--" $viewfiles($view)] r]
+ --boundary $args "--" $viewfiles($view)] r]
} err]} {
error_popup "[mc "Error executing git rev-list:"] $err"
exit 1
set listed 1
if {$j >= 0 && [string match "commit *" $cmit]} {
set ids [string range $cmit 7 [expr {$j - 1}]]
- if {[string match {[-<>]*} $ids]} {
+ if {[string match {[-^<>]*} $ids]} {
switch -- [string index $ids 0] {
"-" {set listed 0}
- "<" {set listed 2}
- ">" {set listed 3}
+ "^" {set listed 2}
+ "<" {set listed 3}
+ ">" {set listed 4}
}
set ids [string range $ids 1 end]
}
proc updatecommits {} {
global viewdata curview phase displayorder ordertok idpending
global children commitrow selectedline thickerline showneartags
+ global isworktree
+
+ set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
if {$phase ne {}} {
stop_rev_list
return $confirm_ok
}
+proc setoptions {} {
+ option add *Panedwindow.showHandle 1 startupFile
+ option add *Panedwindow.sashRelief raised startupFile
+ option add *Button.font uifont startupFile
+ option add *Checkbutton.font uifont startupFile
+ option add *Radiobutton.font uifont startupFile
+ option add *Menu.font uifont startupFile
+ option add *Menubutton.font uifont startupFile
+ option add *Label.font uifont startupFile
+ option add *Message.font uifont startupFile
+ option add *Entry.font uifont startupFile
+}
+
proc makewindow {} {
global canv canv2 canv3 linespc charspc ctext cflist
global tabstop
global findtype findtypemenu findloc findstring fstring geometry
global entries sha1entry sha1string sha1but
global diffcontextstring diffcontext
+ global ignorespace
global maincursor textcursor curtextcursor
global rowctxmenu fakerowmenu mergemax wrapcomment
global highlight_files gdttype
menu .bar
.bar add cascade -label [mc "File"] -menu .bar.file
- .bar configure -font uifont
menu .bar.file
.bar.file add command -label [mc "Update"] -command updatecommits
.bar.file add command -label [mc "Reread references"] -command rereadrefs
.bar.file add command -label [mc "List references"] -command showrefs
.bar.file add command -label [mc "Quit"] -command doquit
- .bar.file configure -font uifont
menu .bar.edit
.bar add cascade -label [mc "Edit"] -menu .bar.edit
.bar.edit add command -label [mc "Preferences"] -command doprefs
- .bar.edit configure -font uifont
- menu .bar.view -font uifont
+ menu .bar.view
.bar add cascade -label [mc "View"] -menu .bar.view
.bar.view add command -label [mc "New view..."] -command {newview 0}
.bar.view add command -label [mc "Edit view..."] -command editview \
.bar add cascade -label [mc "Help"] -menu .bar.help
.bar.help add command -label [mc "About gitk"] -command about
.bar.help add command -label [mc "Key bindings"] -command keys
- .bar.help configure -font uifont
+ .bar.help configure
. configure -menu .bar
# the gui has upper and lower half, parts of a paned window.
set entries $sha1entry
set sha1but .tf.bar.sha1label
button $sha1but -text [mc "SHA1 ID: "] -state disabled -relief flat \
- -command gotocommit -width 8 -font uifont
+ -command gotocommit -width 8
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
entry $sha1entry -width 40 -font textfont -textvariable sha1string
# Status label and progress bar
set statusw .tf.bar.status
- label $statusw -width 15 -relief sunken -font uifont
+ label $statusw -width 15 -relief sunken
pack $statusw -side left -padx 5
set h [expr {[font metrics uifont -linespace] + 2}]
set progresscanv .tf.bar.progress
set progupdatepending 0
# build up the bottom bar of upper window
- label .tf.lbar.flabel -text "[mc "Find"] " -font uifont
- button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1} -font uifont
- button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1} -font uifont
- label .tf.lbar.flab2 -text " [mc "commit"] " -font uifont
+ label .tf.lbar.flabel -text "[mc "Find"] "
+ button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1}
+ button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1}
+ label .tf.lbar.flab2 -text " [mc "commit"] "
pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
-side left -fill y
set gdttype [mc "containing:"]
[mc "touching paths:"] \
[mc "adding/removing string:"]]
trace add variable gdttype write gdttype_change
- $gm conf -font uifont
- .tf.lbar.gdttype conf -font uifont
pack .tf.lbar.gdttype -side left -fill y
set findstring {}
set findtypemenu [tk_optionMenu .tf.lbar.findtype \
findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
trace add variable findtype write findcom_change
- .tf.lbar.findtype configure -font uifont
- .tf.lbar.findtype.menu configure -font uifont
set findloc [mc "All fields"]
tk_optionMenu .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \
[mc "Comments"] [mc "Author"] [mc "Committer"]
trace add variable findloc write find_change
- .tf.lbar.findloc configure -font uifont
- .tf.lbar.findloc.menu configure -font uifont
pack .tf.lbar.findloc -side right
pack .tf.lbar.findtype -side right
pack $fstring -side left -expand 1 -fill x
}
frame .bleft.top
frame .bleft.mid
+ frame .bleft.bottom
- button .bleft.top.search -text [mc "Search"] -command dosearch \
- -font uifont
+ button .bleft.top.search -text [mc "Search"] -command dosearch
pack .bleft.top.search -side left -padx 5
set sstring .bleft.top.sstring
entry $sstring -width 20 -font textfont -textvariable searchstring
lappend entries $sstring
trace add variable searchstring write incrsearch
pack $sstring -side left -expand 1 -fill x
- radiobutton .bleft.mid.diff -text [mc "Diff"] -font uifont \
+ radiobutton .bleft.mid.diff -text [mc "Diff"] \
-command changediffdisp -variable diffelide -value {0 0}
- radiobutton .bleft.mid.old -text [mc "Old version"] -font uifont \
+ radiobutton .bleft.mid.old -text [mc "Old version"] \
-command changediffdisp -variable diffelide -value {0 1}
- radiobutton .bleft.mid.new -text [mc "New version"] -font uifont \
+ radiobutton .bleft.mid.new -text [mc "New version"] \
-command changediffdisp -variable diffelide -value {1 0}
- label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " \
- -font uifont
+ label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
-from 1 -increment 1 -to 10000000 \
trace add variable diffcontextstring write diffcontextchange
lappend entries .bleft.mid.diffcontext
pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
- set ctext .bleft.ctext
+ checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
+ -command changeignorespace -variable ignorespace
+ pack .bleft.mid.ignspace -side left -padx 5
+ set ctext .bleft.bottom.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-state disabled -font textfont \
- -yscrollcommand scrolltext -wrap none
+ -yscrollcommand scrolltext -wrap none \
+ -xscrollcommand ".bleft.bottom.sbhorizontal set"
if {$have_tk85} {
$ctext conf -tabstyle wordprocessor
}
- scrollbar .bleft.sb -command "$ctext yview"
+ scrollbar .bleft.bottom.sb -command "$ctext yview"
+ scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h \
+ -width 10
pack .bleft.top -side top -fill x
pack .bleft.mid -side top -fill x
- pack .bleft.sb -side right -fill y
- pack $ctext -side left -fill both -expand 1
+ grid $ctext .bleft.bottom.sb -sticky nsew
+ grid .bleft.bottom.sbhorizontal -sticky ew
+ grid columnconfigure .bleft.bottom 0 -weight 1
+ grid rowconfigure .bleft.bottom 0 -weight 1
+ grid rowconfigure .bleft.bottom 1 -weight 0
+ pack .bleft.bottom -side top -fill both -expand 1
lappend bglist $ctext
lappend fglist $ctext
frame .bright.mode
radiobutton .bright.mode.patch -text [mc "Patch"] \
-command reselectline -variable cmitmode -value "patch"
- .bright.mode.patch configure -font uifont
radiobutton .bright.mode.tree -text [mc "Tree"] \
-command reselectline -variable cmitmode -value "tree"
- .bright.mode.tree configure -font uifont
grid .bright.mode.patch .bright.mode.tree -sticky ew
pack .bright.mode -side top -fill x
set cflist .bright.cfiles
.pwbottom add .bright
.ctop add .pwbottom
- # restore window position if known
+ # restore window width & height if known
if {[info exists geometry(main)]} {
- wm geometry . "$geometry(main)"
+ if {[scan $geometry(main) "%dx%d" w h] >= 2} {
+ if {$w > [winfo screenwidth .]} {
+ set w [winfo screenwidth .]
+ }
+ if {$h > [winfo screenheight .]} {
+ set h [winfo screenheight .]
+ }
+ wm geometry . "${w}x$h"
+ }
}
if {[tk windowingsystem] eq {aqua}} {
bind . <$M1B-r> dosearchback
bind . <$M1B-s> dosearch
bind . <$M1B-equal> {incrfont 1}
+ bind . <$M1B-plus> {incrfont 1}
bind . <$M1B-KP_Add> {incrfont 1}
bind . <$M1B-minus> {incrfont -1}
bind . <$M1B-KP_Subtract> {incrfont -1}
global canv canv2 canv3 mainfont textfont uifont tabstop
global stuffsaved findmergefiles maxgraphpct
global maxwidth showneartags showlocalchanges
- global viewname viewfiles viewargs viewperm nextviewnum
+ global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
global cmitmode wrapcomment datetimeformat limitdiffs
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
+ global autoselect
if {$stuffsaved} return
if {![winfo viewable .]} return
puts $f [list set maxwidth $maxwidth]
puts $f [list set cmitmode $cmitmode]
puts $f [list set wrapcomment $wrapcomment]
+ puts $f [list set autoselect $autoselect]
puts $f [list set showneartags $showneartags]
puts $f [list set showlocalchanges $showlocalchanges]
puts $f [list set datetimeformat $datetimeformat]
puts -nonewline $f "set permviews {"
for {set v 0} {$v < $nextviewnum} {incr v} {
if {$viewperm($v)} {
- puts $f "{[list $viewname($v) $viewfiles($v) $viewargs($v)]}"
+ puts $f "{[list $viewname($v) $viewfiles($v) $viewargs($v) $viewargscmd($v)]}"
}
}
puts $f "}"
Use and redistribute under the terms of the GNU General Public License"] \
-justify center -aspect 400 -border 2 -bg white -relief groove
pack $w.m -side top -fill x -padx 2 -pady 2
- $w.m configure -font uifont
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
pack $w.ok -side bottom
- $w.ok configure -font uifont
bind $w <Visibility> "focus $w.ok"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> "destroy $w"
}
proc keys {} {
- global uifont
set w .keys
if {[winfo exists $w]} {
raise $w
}
toplevel $w
wm title $w [mc "Gitk key bindings"]
- message $w.m -text [mc "
-Gitk key bindings:
-
-<$M1T-Q> Quit
-<Home> Move to first commit
-<End> Move to last commit
-<Up>, p, i Move up one commit
-<Down>, n, k Move down one commit
-<Left>, z, j Go back in history list
-<Right>, x, l Go forward in history list
-<PageUp> Move up one page in commit list
-<PageDown> Move down one page in commit list
-<$M1T-Home> Scroll to top of commit list
-<$M1T-End> Scroll to bottom of commit list
-<$M1T-Up> Scroll commit list up one line
-<$M1T-Down> Scroll commit list down one line
-<$M1T-PageUp> Scroll commit list up one page
-<$M1T-PageDown> Scroll commit list down one page
-<Shift-Up> Find backwards (upwards, later commits)
-<Shift-Down> Find forwards (downwards, earlier commits)
-<Delete>, b Scroll diff view up one page
-<Backspace> Scroll diff view up one page
-<Space> Scroll diff view down one page
-u Scroll diff view up 18 lines
-d Scroll diff view down 18 lines
-<$M1T-F> Find
-<$M1T-G> Move to next find hit
-<Return> Move to next find hit
-/ Move to next find hit, or redo find
-? Move to previous find hit
-f Scroll diff view to next file
-<$M1T-S> Search for next hit in diff view
-<$M1T-R> Search for previous hit in diff view
-<$M1T-KP+> Increase font size
-<$M1T-plus> Increase font size
-<$M1T-KP-> Decrease font size
-<$M1T-minus> Decrease font size
-<F5> Update
-"] \
+ message $w.m -text "
+[mc "Gitk key bindings:"]
+
+[mc "<%s-Q> Quit" $M1T]
+[mc "<Home> Move to first commit"]
+[mc "<End> Move to last commit"]
+[mc "<Up>, p, i Move up one commit"]
+[mc "<Down>, n, k Move down one commit"]
+[mc "<Left>, z, j Go back in history list"]
+[mc "<Right>, x, l Go forward in history list"]
+[mc "<PageUp> Move up one page in commit list"]
+[mc "<PageDown> Move down one page in commit list"]
+[mc "<%s-Home> Scroll to top of commit list" $M1T]
+[mc "<%s-End> Scroll to bottom of commit list" $M1T]
+[mc "<%s-Up> Scroll commit list up one line" $M1T]
+[mc "<%s-Down> Scroll commit list down one line" $M1T]
+[mc "<%s-PageUp> Scroll commit list up one page" $M1T]
+[mc "<%s-PageDown> Scroll commit list down one page" $M1T]
+[mc "<Shift-Up> Find backwards (upwards, later commits)"]
+[mc "<Shift-Down> Find forwards (downwards, earlier commits)"]
+[mc "<Delete>, b Scroll diff view up one page"]
+[mc "<Backspace> Scroll diff view up one page"]
+[mc "<Space> Scroll diff view down one page"]
+[mc "u Scroll diff view up 18 lines"]
+[mc "d Scroll diff view down 18 lines"]
+[mc "<%s-F> Find" $M1T]
+[mc "<%s-G> Move to next find hit" $M1T]
+[mc "<Return> Move to next find hit"]
+[mc "/ Move to next find hit, or redo find"]
+[mc "? Move to previous find hit"]
+[mc "f Scroll diff view to next file"]
+[mc "<%s-S> Search for next hit in diff view" $M1T]
+[mc "<%s-R> Search for previous hit in diff view" $M1T]
+[mc "<%s-KP+> Increase font size" $M1T]
+[mc "<%s-plus> Increase font size" $M1T]
+[mc "<%s-KP-> Decrease font size" $M1T]
+[mc "<%s-minus> Decrease font size" $M1T]
+[mc "<F5> Update"]
+" \
-justify left -bg white -border 2 -relief groove
pack $w.m -side top -fill both -padx 2 -pady 2
- $w.m configure -font uifont
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
pack $w.ok -side bottom
- $w.ok configure -font uifont
bind $w <Visibility> "focus $w.ok"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> "destroy $w"
# Code to implement multiple views
proc newview {ishighlight} {
- global nextviewnum newviewname newviewperm uifont newishighlight
- global newviewargs revtreeargs
+ global nextviewnum newviewname newviewperm newishighlight
+ global newviewargs revtreeargs viewargscmd newviewargscmd curview
set newishighlight $ishighlight
set top .gitkview
raise $top
return
}
- set newviewname($nextviewnum) "View $nextviewnum"
+ set newviewname($nextviewnum) "[mc "View"] $nextviewnum"
set newviewperm($nextviewnum) 0
set newviewargs($nextviewnum) [shellarglist $revtreeargs]
+ set newviewargscmd($nextviewnum) $viewargscmd($curview)
vieweditor $top $nextviewnum [mc "Gitk view definition"]
}
proc editview {} {
global curview
global viewname viewperm newviewname newviewperm
- global viewargs newviewargs
+ global viewargs newviewargs viewargscmd newviewargscmd
set top .gitkvedit-$curview
if {[winfo exists $top]} {
set newviewname($curview) $viewname($curview)
set newviewperm($curview) $viewperm($curview)
set newviewargs($curview) [shellarglist $viewargs($curview)]
+ set newviewargscmd($curview) $viewargscmd($curview)
vieweditor $top $curview "Gitk: edit view $viewname($curview)"
}
proc vieweditor {top n title} {
- global newviewname newviewperm viewfiles
- global uifont
+ global newviewname newviewperm viewfiles bgcolor
toplevel $top
wm title $top $title
- label $top.nl -text [mc "Name"] -font uifont
- entry $top.name -width 20 -textvariable newviewname($n) -font uifont
+ label $top.nl -text [mc "Name"]
+ entry $top.name -width 20 -textvariable newviewname($n)
grid $top.nl $top.name -sticky w -pady 5
- checkbutton $top.perm -text [mc "Remember this view"] -variable newviewperm($n) \
- -font uifont
+ checkbutton $top.perm -text [mc "Remember this view"] \
+ -variable newviewperm($n)
grid $top.perm - -pady 5 -sticky w
- message $top.al -aspect 1000 -font uifont \
+ message $top.al -aspect 1000 \
-text [mc "Commits to include (arguments to git rev-list):"]
grid $top.al - -sticky w -pady 5
entry $top.args -width 50 -textvariable newviewargs($n) \
- -background white -font uifont
+ -background $bgcolor
grid $top.args - -sticky ew -padx 5
- message $top.l -aspect 1000 -font uifont \
+
+ message $top.ac -aspect 1000 \
+ -text [mc "Command to generate more commits to include:"]
+ grid $top.ac - -sticky w -pady 5
+ entry $top.argscmd -width 50 -textvariable newviewargscmd($n) \
+ -background white
+ grid $top.argscmd - -sticky ew -padx 5
+
+ message $top.l -aspect 1000 \
-text [mc "Enter files and directories to include, one per line:"]
grid $top.l - -sticky w
- text $top.t -width 40 -height 10 -background white -font uifont
+ text $top.t -width 40 -height 10 -background $bgcolor -font uifont
if {[info exists viewfiles($n)]} {
foreach f $viewfiles($n) {
$top.t insert end $f
}
grid $top.t - -sticky ew -padx 5
frame $top.buts
- button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] \
- -font uifont
- button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] \
- -font uifont
+ button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
+ button $top.buts.can -text [mc "Cancel"] -command [list destroy $top]
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
proc newviewok {top n} {
global nextviewnum newviewperm newviewname newishighlight
global viewname viewfiles viewperm selectedview curview
- global viewargs newviewargs viewhlmenu
+ global viewargs newviewargs viewargscmd newviewargscmd viewhlmenu
if {[catch {
set newargs [shellsplit $newviewargs($n)]
set viewperm($n) $newviewperm($n)
set viewfiles($n) $files
set viewargs($n) $newargs
+ set viewargscmd($n) $newviewargscmd($n)
addviewmenu $n
if {!$newishighlight} {
run showview $n
# doviewmenu $viewhlmenu 1 [list addvhighlight $n] \
# entryconf [list -label $viewname($n) -value $viewname($n)]
}
- if {$files ne $viewfiles($n) || $newargs ne $viewargs($n)} {
+ if {$files ne $viewfiles($n) || $newargs ne $viewargs($n) || \
+ $newviewargscmd($n) ne $viewargscmd($n)} {
set viewfiles($n) $files
set viewargs($n) $newargs
+ set viewargscmd($n) $newviewargscmd($n)
if {$curview == $n} {
run updatecommits
}
set ybot [expr {[lindex $span 1] * $ymax}]
if {$ytop < $y && $y < $ybot} {
set yscreen [expr {$y - $ytop}]
- } else {
- set yscreen [expr {($ybot - $ytop) / 2}]
}
} elseif {[info exists pending_select]} {
set selid $pending_select
set yf 0
set row {}
set selectfirst 0
- if {$selid ne {} && [info exists commitrow($n,$selid)]} {
+ if {[info exists yscreen] && [info exists commitrow($n,$selid)]} {
set row $commitrow($n,$selid)
# try to get the selected row in the same position on the screen
set ymax [lindex [$canv cget -scrollregion] 3]
if {![info exists selectedline]} return
set isbold 0
- if {$highlight_related eq [mc "Descendent"] ||
- $highlight_related eq [mc "Not descendent"]} {
+ if {$highlight_related eq [mc "Descendant"] ||
+ $highlight_related eq [mc "Not descendant"]} {
if {![info exists descendent($id)]} {
is_descendent $id
}
- if {$descendent($id) == ($highlight_related eq [mc "Descendent"])} {
+ if {$descendent($id) == ($highlight_related eq [mc "Descendant"])} {
set isbold 1
}
} elseif {$highlight_related eq [mc "Ancestor"] ||
# spawn off a process to do git diff-index --cached HEAD
proc dodiffindex {} {
global localirow localfrow lserial showlocalchanges
+ global isworktree
- if {!$showlocalchanges} return
+ if {!$showlocalchanges || !$isworktree} return
incr lserial
set localfrow -1
set localirow -1
global linehtag linentag linedtag selectedline
global canvxmax boldrows boldnamerows fgcolor nullid nullid2
- # listed is 0 for boundary, 1 for normal, 2 for left, 3 for right
+ # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
set listed [lindex $commitlisted $row]
if {$id eq $nullid} {
set ofill red
} elseif {$id eq $nullid2} {
set ofill green
} else {
- set ofill [expr {$listed != 0? "blue": "white"}]
+ set ofill [expr {$listed != 0 ? $listed == 2 ? "gray" : "blue" : "white"}]
}
set x [xc $row $col]
set y [yc $row]
set orad [expr {$linespc / 3}]
- if {$listed <= 1} {
+ if {$listed <= 2} {
set t [$canv create oval [expr {$x - $orad}] [expr {$y - $orad}] \
[expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
-fill $ofill -outline $fgcolor -width 1 -tags circle]
- } elseif {$listed == 2} {
+ } elseif {$listed == 3} {
# triangle pointing left for left-side commits
set t [$canv create polygon \
[expr {$x - $orad}] $y \
global commentend idtags linknum
global mergemax numcommits pending_select
global cmitmode showneartags allcommits
+ global autoselect
catch {unset pending_select}
$canv delete hover
set currentid $id
$sha1entry delete 0 end
$sha1entry insert 0 $id
- $sha1entry selection from 0
- $sha1entry selection to end
+ if {$autoselect} {
+ $sha1entry selection from 0
+ $sha1entry selection to end
+ }
rhighlight_sel $id
$ctext conf -state normal
proc mergediff {id l} {
global diffmergeid mdifffd
global diffids
+ global diffcontext
global parentlist
global limitdiffs viewfiles curview
set diffmergeid $id
set diffids $id
# this doesn't seem to actually affect anything...
- set cmd [concat | git diff-tree --no-commit-id --cc $id]
+ set cmd [concat | git diff-tree --no-commit-id --cc -U$diffcontext $id]
if {$limitdiffs && $viewfiles($curview) ne {}} {
set cmd [concat $cmd -- $viewfiles($curview)]
}
}
}
+proc changeignorespace {} {
+ reselectline
+}
+
proc getblobdiffs {ids} {
global blobdifffd diffids env
global diffinhdr treediffs
global diffcontext
+ global ignorespace
global limitdiffs viewfiles curview
set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
+ if {$ignorespace} {
+ append cmd " -w"
+ }
if {$limitdiffs && $viewfiles($curview) ne {}} {
set cmd [concat $cmd -- $viewfiles($curview)]
}
proc scrolltext {f0 f1} {
global searchstring
- .bleft.sb set $f0 $f1
+ .bleft.bottom.sb set $f0 $f1
if {$searchstring ne {}} {
searchmarkvisible 0
}
return
}
if {[catch {
- set dir [gitdir]
- set fname [file join $dir "refs/tags" $tag]
- set f [open $fname w]
- puts $f $id
- close $f
+ exec git tag $tag $id
} err]} {
error_popup "[mc "Error creating tag:"] $err"
return
grid $top.list $top.ysb -sticky nsew
grid $top.xsb x -sticky ew
frame $top.f
- label $top.f.l -text "[mc "Filter"]: " -font uifont
- entry $top.f.e -width 20 -textvariable reflistfilter -font uifont
+ label $top.f.l -text "[mc "Filter"]: "
+ entry $top.f.e -width 20 -textvariable reflistfilter
set reflistfilter "*"
trace add variable reflistfilter write reflistfilter_change
pack $top.f.e -side right -fill x -expand 1
pack $top.f.l -side left
grid $top.f - -sticky ew -pady 2
- button $top.close -command [list destroy $top] -text [mc "Close"] \
- -font uifont
+ button $top.close -command [list destroy $top] -text [mc "Close"]
grid $top.close -
grid columnconfigure $top 0 -weight 1
grid rowconfigure $top 0 -weight 1
eval font config sample [font actual $font]
toplevel $top
wm title $top [mc "Gitk font chooser"]
- label $top.l -textvariable fontparam(which) -font uifont
+ label $top.l -textvariable fontparam(which)
pack $top.l -side top
set fontlist [lsort [font families]]
frame $top.f
bind $top.c <Configure> [list centertext $top.c]
pack $top.c -side top -fill x
frame $top.buts
- button $top.buts.ok -text [mc "OK"] -command fontok -default active \
- -font uifont
- button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal \
- -font uifont
+ button $top.buts.ok -text [mc "OK"] -command fontok -default active
+ button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
global maxwidth maxgraphpct
global oldprefs prefstop showneartags showlocalchanges
global bgcolor fgcolor ctext diffcolors selectbgcolor
- global uifont tabstop limitdiffs
+ global tabstop limitdiffs autoselect
set top .gitkprefs
set prefstop $top
toplevel $top
wm title $top [mc "Gitk preferences"]
label $top.ldisp -text [mc "Commit list display options"]
- $top.ldisp configure -font uifont
grid $top.ldisp - -sticky w -pady 10
label $top.spacer -text " "
label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
checkbutton $top.showlocal.b -variable showlocalchanges
pack $top.showlocal.b $top.showlocal.l -side left
grid x $top.showlocal -sticky w
+ frame $top.autoselect
+ label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont
+ checkbutton $top.autoselect.b -variable autoselect
+ pack $top.autoselect.b $top.autoselect.l -side left
+ grid x $top.autoselect -sticky w
label $top.ddisp -text [mc "Diff display options"]
- $top.ddisp configure -font uifont
grid $top.ddisp - -sticky w -pady 10
label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $top.ldiff -sticky w
label $top.cdisp -text [mc "Colors: press to choose"]
- $top.cdisp configure -font uifont
grid $top.cdisp - -sticky w -pady 10
label $top.bg -padx 40 -relief sunk -background $bgcolor
button $top.bgbut -text [mc "Background"] -font optionfont \
- -command [list choosecolor bgcolor 0 $top.bg background setbg]
+ -command [list choosecolor bgcolor {} $top.bg background setbg]
grid x $top.bgbut $top.bg -sticky w
label $top.fg -padx 40 -relief sunk -background $fgcolor
button $top.fgbut -text [mc "Foreground"] -font optionfont \
- -command [list choosecolor fgcolor 0 $top.fg foreground setfg]
+ -command [list choosecolor fgcolor {} $top.fg foreground setfg]
grid x $top.fgbut $top.fg -sticky w
label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
button $top.diffoldbut -text [mc "Diff: old lines"] -font optionfont \
grid x $top.hunksepbut $top.hunksep -sticky w
label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor
button $top.selbgbut -text [mc "Select bg"] -font optionfont \
- -command [list choosecolor selectbgcolor 0 $top.selbgsep background setselbg]
+ -command [list choosecolor selectbgcolor {} $top.selbgsep background setselbg]
grid x $top.selbgbut $top.selbgsep -sticky w
label $top.cfont -text [mc "Fonts: press to choose"]
- $top.cfont configure -font uifont
grid $top.cfont - -sticky w -pady 10
mkfontdisp mainfont $top [mc "Main font"]
mkfontdisp textfont $top [mc "Diff display font"]
frame $top.buts
button $top.buts.ok -text [mc "OK"] -command prefsok -default active
- $top.buts.ok configure -font uifont
button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
- $top.buts.can configure -font uifont
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
set showlocalchanges 1
set limitdiffs 1
set datetimeformat "%Y-%m-%d %H:%M:%S"
+set autoselect 1
set colors {green red blue magenta darkgrey brown orange}
set bgcolor white
set fgcolor black
set diffcolors {red "#00a000" blue}
set diffcontext 3
+set ignorespace 0
set selectbgcolor gray85
## For msgcat loading, first locate the installation location.
parsefont uifont $uifont
eval font create uifont [fontflags uifont]
+setoptions
+
# check that we can find a .git directory somewhere...
if {[catch {set gitdir [gitdir]}]} {
show_error {} . [mc "Cannot find a git repository here."]
set revtreeargs {}
set cmdline_files {}
set i 0
+set revtreeargscmd {}
foreach arg $argv {
- switch -- $arg {
+ switch -glob -- $arg {
"" { }
"-d" { set datemode 1 }
"--merge" {
set cmdline_files [lrange $argv [expr {$i + 1}] end]
break
}
+ "--argscmd=*" {
+ set revtreeargscmd [string range $arg 10 end]
+ }
default {
lappend revtreeargs $arg
}
set viewfiles(0) {}
set viewperm(0) 0
set viewargs(0) {}
+set viewargscmd(0) {}
set cmdlineok 0
set stopped 0
set localirow -1
set localfrow -1
set lserial 0
+set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
setcoords
makewindow
# wait for the window to become visible
wm title . "[file tail $argv0]: [file tail [pwd]]"
readrefs
-if {$cmdline_files ne {} || $revtreeargs ne {}} {
+if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {
# create a view for the files/dirs specified on the command line
set curview 1
set selectedview 1
set viewname(1) [mc "Command line"]
set viewfiles(1) $cmdline_files
set viewargs(1) $revtreeargs
+ set viewargscmd(1) $revtreeargscmd
set viewperm(1) 0
addviewmenu 1
.bar.view entryconf [mc "Edit view..."] -state normal
set viewname($n) [lindex $v 0]
set viewfiles($n) [lindex $v 1]
set viewargs($n) [lindex $v 2]
+ set viewargscmd($n) [lindex $v 3]
set viewperm($n) 1
addviewmenu $n
}