From: Paul Mackerras Date: Tue, 11 Mar 2008 11:21:39 +0000 (+1100) Subject: Merge branch 'master' into dev X-Git-Tag: v1.5.6-rc0~20^2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=92e22ca0a22a916a806d801f8d2f5f26bc92ddc4;p=git.git Merge branch 'master' into dev --- 92e22ca0a22a916a806d801f8d2f5f26bc92ddc4 diff --cc gitk index 1125f68d3,84ab02e15..bf6eb0132 --- a/gitk +++ b/gitk @@@ -94,29 -82,37 +94,39 @@@ proc dorunq {} proc start_rev_list {view} { global startmsecs global commfd leftover tclencoding datemode - global viewargs viewfiles commitidx viewcomplete - global viewargs viewargscmd viewfiles commitidx viewcomplete vnextroot ++ global viewargs viewargscmd viewfiles commitidx viewcomplete global showlocalchanges commitinterest mainheadid global progressdirn progresscoords proglastnc curview + global viewactive loginstance viewinstances + global pending_select mainheadid set startmsecs [clock clicks -milliseconds] set commitidx($view) 0 set viewcomplete($view) 0 - set vnextroot($view) 0 + set viewactive($view) 1 + varcinit $view + + 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 \ + set fd [open [concat | git log --no-color -z --pretty=raw --parents \ - --boundary $viewargs($view) "--" $viewfiles($view)] r] + --boundary $args "--" $viewfiles($view)] r] } err]} { - error_popup "[mc "Error executing git rev-list:"] $err" + error_popup "[mc "Error executing git log:"] $err" exit 1 } - set commfd($view) $fd - set leftover($view) {} + set i [incr loginstance] + set viewinstances($view) [list $i] + set commfd($i) $fd + set leftover($i) {} if {$showlocalchanges} { lappend commitinterest($mainheadid) {dodiffindex} } @@@ -157,82 -148,7 +167,84 @@@ proc getcommits {} initlayout start_rev_list $curview show_status [mc "Reading commits..."] + set need_redisplay 1 +} + +proc updatecommits {} { + global curview viewargs viewfiles viewinstances + global viewactive viewcomplete loginstance tclencoding mainheadid + global startmsecs commfd showneartags showlocalchanges leftover + global mainheadid pending_select ++ global isworktree + ++ set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}] + set oldmainid $mainheadid + rereadrefs + if {$showlocalchanges} { + if {$mainheadid ne $oldmainid} { + dohidelocalchanges + } + if {[commitinview $mainheadid $curview]} { + dodiffindex + } + } + set view $curview + if {[catch { + set fd [open [concat | git log --no-color -z --pretty=raw --parents \ + --boundary $viewargs($view) --not [seeds $view] \ + "--" $viewfiles($view)] r] + } err]} { + error_popup "Error executing git log: $err" + exit 1 + } + if {$viewactive($view) == 0} { + set startmsecs [clock clicks -milliseconds] + } + set i [incr loginstance] + lappend viewinstances($view) $i + set commfd($i) $fd + set leftover($i) {} + fconfigure $fd -blocking 0 -translation lf -eofchar {} + if {$tclencoding != {}} { + fconfigure $fd -encoding $tclencoding + } + filerun $fd [list getcommitlines $fd $i $view 1] + incr viewactive($view) + set viewcomplete($view) 0 + set pending_select $mainheadid + nowbusy $view "Reading" + if {$showneartags} { + getallcommits + } +} + +proc reloadcommits {} { + global curview viewcomplete selectedline currentid thickerline + global showneartags treediffs commitinterest cached_commitrow + global progresscoords targetid + + if {!$viewcomplete($curview)} { + stop_rev_list $curview + set progresscoords {0 0} + adjustprogress + } + resetvarcs $curview + catch {unset selectedline} + catch {unset currentid} + catch {unset thickerline} + catch {unset treediffs} + readrefs + changedrefs + if {$showneartags} { + getallcommits + } + clear_display + catch {unset commitinterest} + catch {unset cached_commitrow} + catch {unset targetid} + setcanvscroll + getcommits + return 0 } # This makes a string representation of a positive integer which @@@ -2803,11 -2022,13 +2844,13 @@@ proc newviewok {top 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 + run reloadcommits } } } @@@ -3624,10 -2885,13 +3667,11 @@@ proc dohidelocalchanges {} # spawn off a process to do git diff-index --cached HEAD proc dodiffindex {} { - global localirow localfrow lserial showlocalchanges + global lserial showlocalchanges + global isworktree - if {!$showlocalchanges} return + if {!$showlocalchanges || !$isworktree} return incr lserial - set localfrow -1 - set localirow -1 set fd [open "|git diff-index --cached HEAD" r] fconfigure $fd -blocking 0 filerun $fd [list readdiffindex $fd $lserial] @@@ -5429,7 -4693,7 +5473,8 @@@ proc selectline {l isnew} global commentend idtags linknum global mergemax numcommits pending_select global cmitmode showneartags allcommits + global targetrow targetid lastscrollrows + global autoselect catch {unset pending_select} $canv delete hover @@@ -5485,13 -4740,19 +5530,15 @@@ make_secsel $l if {$isnew} { - addtohistory [list selectline $l 0] + addtohistory [list selbyid $id] } - set selectedline $l - - set id [lindex $displayorder $l] - 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 @@@ -9421,13 -8691,16 +9478,15 @@@ set highlight_files { set viewfiles(0) {} set viewperm(0) 0 set viewargs(0) {} + set viewargscmd(0) {} +set loginstance 0 set cmdlineok 0 set stopped 0 set stuffsaved 0 set patchnum 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