Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Update swedish translation. gitk: Updated German translation gitk: Fallback to selecting the head commit upon load gitk: Fixed automatic row selection during load gitk: Fixed broken exception handling in diff gitk: On Windows, use a Cygwin-specific flag for kill gitk: Arrange to kill diff-files & diff-index on quit gitk: Kill back-end processes on window close
This commit is contained in:
148
gitk-git/gitk
148
gitk-git/gitk
@ -90,6 +90,15 @@ proc dorunq {} {
|
||||
}
|
||||
}
|
||||
|
||||
proc reg_instance {fd} {
|
||||
global commfd leftover loginstance
|
||||
|
||||
set i [incr loginstance]
|
||||
set commfd($i) $fd
|
||||
set leftover($i) {}
|
||||
return $i
|
||||
}
|
||||
|
||||
proc unmerged_files {files} {
|
||||
global nr_unmerged
|
||||
|
||||
@ -294,11 +303,11 @@ proc parseviewrevs {view revs} {
|
||||
# Start off a git log process and arrange to read its output
|
||||
proc start_rev_list {view} {
|
||||
global startmsecs commitidx viewcomplete curview
|
||||
global commfd leftover tclencoding
|
||||
global tclencoding
|
||||
global viewargs viewargscmd viewfiles vfilelimit
|
||||
global showlocalchanges commitinterest
|
||||
global viewactive loginstance viewinstances vmergeonly
|
||||
global pending_select mainheadid
|
||||
global viewactive viewinstances vmergeonly
|
||||
global mainheadid
|
||||
global vcanopt vflags vrevs vorigargs
|
||||
|
||||
set startmsecs [clock clicks -milliseconds]
|
||||
@ -354,10 +363,8 @@ proc start_rev_list {view} {
|
||||
error_popup "[mc "Error executing git log:"] $err"
|
||||
return 0
|
||||
}
|
||||
set i [incr loginstance]
|
||||
set i [reg_instance $fd]
|
||||
set viewinstances($view) [list $i]
|
||||
set commfd($i) $fd
|
||||
set leftover($i) {}
|
||||
if {$showlocalchanges && $mainheadid ne {}} {
|
||||
lappend commitinterest($mainheadid) {dodiffindex}
|
||||
}
|
||||
@ -367,36 +374,63 @@ proc start_rev_list {view} {
|
||||
}
|
||||
filerun $fd [list getcommitlines $fd $i $view 0]
|
||||
nowbusy $view [mc "Reading"]
|
||||
if {$view == $curview} {
|
||||
set pending_select $mainheadid
|
||||
}
|
||||
set viewcomplete($view) 0
|
||||
set viewactive($view) 1
|
||||
return 1
|
||||
}
|
||||
|
||||
proc stop_rev_list {view} {
|
||||
global commfd viewinstances leftover
|
||||
proc stop_instance {inst} {
|
||||
global commfd leftover
|
||||
|
||||
foreach inst $viewinstances($view) {
|
||||
set fd $commfd($inst)
|
||||
catch {
|
||||
set pid [pid $fd]
|
||||
set fd $commfd($inst)
|
||||
catch {
|
||||
set pid [pid $fd]
|
||||
|
||||
if {$::tcl_platform(platform) eq {windows}} {
|
||||
exec kill -f $pid
|
||||
} else {
|
||||
exec kill $pid
|
||||
}
|
||||
catch {close $fd}
|
||||
nukefile $fd
|
||||
unset commfd($inst)
|
||||
unset leftover($inst)
|
||||
}
|
||||
catch {close $fd}
|
||||
nukefile $fd
|
||||
unset commfd($inst)
|
||||
unset leftover($inst)
|
||||
}
|
||||
|
||||
proc stop_backends {} {
|
||||
global commfd
|
||||
|
||||
foreach inst [array names commfd] {
|
||||
stop_instance $inst
|
||||
}
|
||||
}
|
||||
|
||||
proc stop_rev_list {view} {
|
||||
global viewinstances
|
||||
|
||||
foreach inst $viewinstances($view) {
|
||||
stop_instance $inst
|
||||
}
|
||||
set viewinstances($view) {}
|
||||
}
|
||||
|
||||
proc getcommits {} {
|
||||
proc reset_pending_select {selid} {
|
||||
global pending_select mainheadid
|
||||
|
||||
if {$selid ne {}} {
|
||||
set pending_select $selid
|
||||
} else {
|
||||
set pending_select $mainheadid
|
||||
}
|
||||
}
|
||||
|
||||
proc getcommits {selid} {
|
||||
global canv curview need_redisplay viewactive
|
||||
|
||||
initlayout
|
||||
if {[start_rev_list $curview]} {
|
||||
reset_pending_select $selid
|
||||
show_status [mc "Reading commits..."]
|
||||
set need_redisplay 1
|
||||
} else {
|
||||
@ -406,8 +440,8 @@ proc getcommits {} {
|
||||
|
||||
proc updatecommits {} {
|
||||
global curview vcanopt vorigargs vfilelimit viewinstances
|
||||
global viewactive viewcomplete loginstance tclencoding
|
||||
global startmsecs commfd showneartags showlocalchanges leftover
|
||||
global viewactive viewcomplete tclencoding
|
||||
global startmsecs showneartags showlocalchanges
|
||||
global mainheadid pending_select
|
||||
global isworktree
|
||||
global varcid vposids vnegids vflags vrevs
|
||||
@ -468,10 +502,8 @@ proc updatecommits {} {
|
||||
if {$viewactive($view) == 0} {
|
||||
set startmsecs [clock clicks -milliseconds]
|
||||
}
|
||||
set i [incr loginstance]
|
||||
set i [reg_instance $fd]
|
||||
lappend viewinstances($view) $i
|
||||
set commfd($i) $fd
|
||||
set leftover($i) {}
|
||||
fconfigure $fd -blocking 0 -translation lf -eofchar {}
|
||||
if {$tclencoding != {}} {
|
||||
fconfigure $fd -encoding $tclencoding
|
||||
@ -479,7 +511,7 @@ proc updatecommits {} {
|
||||
filerun $fd [list getcommitlines $fd $i $view 1]
|
||||
incr viewactive($view)
|
||||
set viewcomplete($view) 0
|
||||
set pending_select $mainheadid
|
||||
reset_pending_select {}
|
||||
nowbusy $view "Reading"
|
||||
if {$showneartags} {
|
||||
getallcommits
|
||||
@ -491,6 +523,11 @@ proc reloadcommits {} {
|
||||
global showneartags treediffs commitinterest cached_commitrow
|
||||
global targetid
|
||||
|
||||
set selid {}
|
||||
if {$selectedline ne {}} {
|
||||
set selid $currentid
|
||||
}
|
||||
|
||||
if {!$viewcomplete($curview)} {
|
||||
stop_rev_list $curview
|
||||
}
|
||||
@ -509,7 +546,7 @@ proc reloadcommits {} {
|
||||
catch {unset cached_commitrow}
|
||||
catch {unset targetid}
|
||||
setcanvscroll
|
||||
getcommits
|
||||
getcommits $selid
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -1469,8 +1506,15 @@ proc chewcommits {} {
|
||||
global numcommits startmsecs
|
||||
|
||||
if {[info exists pending_select]} {
|
||||
set row [first_real_row]
|
||||
selectline $row 1
|
||||
update
|
||||
reset_pending_select {}
|
||||
|
||||
if {[commitinview $pending_select $curview]} {
|
||||
selectline [rowofcommit $pending_select] 1
|
||||
} else {
|
||||
set row [first_real_row]
|
||||
selectline $row 1
|
||||
}
|
||||
}
|
||||
if {$commitidx($curview) > 0} {
|
||||
#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
|
||||
@ -2103,6 +2147,7 @@ proc makewindow {} {
|
||||
bind . <$M1B-minus> {incrfont -1}
|
||||
bind . <$M1B-KP_Subtract> {incrfont -1}
|
||||
wm protocol . WM_DELETE_WINDOW doquit
|
||||
bind . <Destroy> {stop_backends}
|
||||
bind . <Button-1> "click %W"
|
||||
bind $fstring <Key-Return> {dofind 1 1}
|
||||
bind $sha1entry <Key-Return> gotocommit
|
||||
@ -3300,10 +3345,7 @@ proc showview {n} {
|
||||
|
||||
run refill_reflist
|
||||
if {![info exists viewcomplete($n)]} {
|
||||
if {$selid ne {}} {
|
||||
set pending_select $selid
|
||||
}
|
||||
getcommits
|
||||
getcommits $selid
|
||||
return
|
||||
}
|
||||
|
||||
@ -3337,18 +3379,18 @@ proc showview {n} {
|
||||
drawvisible
|
||||
if {$row ne {}} {
|
||||
selectline $row 0
|
||||
} elseif {$mainheadid ne {} && [commitinview $mainheadid $curview]} {
|
||||
selectline [rowofcommit $mainheadid] 1
|
||||
} elseif {!$viewcomplete($n)} {
|
||||
if {$selid ne {}} {
|
||||
set pending_select $selid
|
||||
} else {
|
||||
set pending_select $mainheadid
|
||||
}
|
||||
reset_pending_select $selid
|
||||
} else {
|
||||
set row [first_real_row]
|
||||
if {$row < $numcommits} {
|
||||
selectline $row 0
|
||||
reset_pending_select {}
|
||||
|
||||
if {[commitinview $pending_select $curview]} {
|
||||
selectline [rowofcommit $pending_select] 1
|
||||
} else {
|
||||
set row [first_real_row]
|
||||
if {$row < $numcommits} {
|
||||
selectline $row 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if {!$viewcomplete($n)} {
|
||||
@ -4011,6 +4053,7 @@ proc layoutmore {} {
|
||||
}
|
||||
if {[info exists pending_select] &&
|
||||
[commitinview $pending_select $curview]} {
|
||||
update
|
||||
selectline [rowofcommit $pending_select] 1
|
||||
}
|
||||
drawvisible
|
||||
@ -4048,10 +4091,11 @@ proc dodiffindex {} {
|
||||
incr lserial
|
||||
set fd [open "|git diff-index --cached HEAD" r]
|
||||
fconfigure $fd -blocking 0
|
||||
filerun $fd [list readdiffindex $fd $lserial]
|
||||
set i [reg_instance $fd]
|
||||
filerun $fd [list readdiffindex $fd $lserial $i]
|
||||
}
|
||||
|
||||
proc readdiffindex {fd serial} {
|
||||
proc readdiffindex {fd serial inst} {
|
||||
global mainheadid nullid nullid2 curview commitinfo commitdata lserial
|
||||
|
||||
set isdiff 1
|
||||
@ -4062,7 +4106,7 @@ proc readdiffindex {fd serial} {
|
||||
set isdiff 0
|
||||
}
|
||||
# we only need to see one line and we don't really care what it says...
|
||||
close $fd
|
||||
stop_instance $inst
|
||||
|
||||
if {$serial != $lserial} {
|
||||
return 0
|
||||
@ -4071,7 +4115,8 @@ proc readdiffindex {fd serial} {
|
||||
# now see if there are any local changes not checked in to the index
|
||||
set fd [open "|git diff-files" r]
|
||||
fconfigure $fd -blocking 0
|
||||
filerun $fd [list readdifffiles $fd $serial]
|
||||
set i [reg_instance $fd]
|
||||
filerun $fd [list readdifffiles $fd $serial $i]
|
||||
|
||||
if {$isdiff && ![commitinview $nullid2 $curview]} {
|
||||
# add the line for the changes in the index to the graph
|
||||
@ -4088,7 +4133,7 @@ proc readdiffindex {fd serial} {
|
||||
return 0
|
||||
}
|
||||
|
||||
proc readdifffiles {fd serial} {
|
||||
proc readdifffiles {fd serial inst} {
|
||||
global mainheadid nullid nullid2 curview
|
||||
global commitinfo commitdata lserial
|
||||
|
||||
@ -4100,7 +4145,7 @@ proc readdifffiles {fd serial} {
|
||||
set isdiff 0
|
||||
}
|
||||
# we only need to see one line and we don't really care what it says...
|
||||
close $fd
|
||||
stop_instance $inst
|
||||
|
||||
if {$serial != $lserial} {
|
||||
return 0
|
||||
@ -6430,9 +6475,10 @@ proc diffcmd {ids flags} {
|
||||
proc gettreediffs {ids} {
|
||||
global treediff treepending
|
||||
|
||||
if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id}] r]}]} return
|
||||
|
||||
set treepending $ids
|
||||
set treediff {}
|
||||
if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id}] r]}]} return
|
||||
fconfigure $gdtf -blocking 0
|
||||
filerun $gdtf [list gettreediffline $gdtf $ids]
|
||||
}
|
||||
@ -9945,4 +9991,4 @@ if {[info exists permviews]} {
|
||||
addviewmenu $n
|
||||
}
|
||||
}
|
||||
getcommits
|
||||
getcommits {}
|
||||
|
Reference in New Issue
Block a user