- global commitlisted commfd phase
- global startmsecs nextupdate ncmupdate
- global idtags idheads idotherrefs
- global leftover
- global parsed_args
- global canv mainfont
- global oldcommits commits
- global parents nchildren children
-
- set old_args $parsed_args
- parse_args $rargs
-
- if {$phase == "getcommits" || $phase == "incrdraw"} {
- # havent read all the old commits, just start again from scratch
- stopfindproc
- set oldcommits {}
- set commits {}
- foreach v {children nchildren parents commitlisted commitinfo
- selectedline matchinglines treediffs
- mergefilelist currentid rowtextx} {
- global $v
- catch {unset $v}
- }
- readrefs
- if {$phase == "incrdraw"} {
- allcanvs delete all
- $canv create text 3 3 -anchor nw -text "Reading commits..." \
- -font $mainfont -tags textitems
- set phase getcommits
- }
- start_rev_list $parsed_args
- return
- }
-
- foreach id $old_args {
- if {![regexp {^[0-9a-f]{40}$} $id]} continue
- if {[info exists oldref($id)]} continue
- set oldref($id) $id
- lappend ignoreold "^$id"
- }
- foreach id $parsed_args {
- if {![regexp {^[0-9a-f]{40}$} $id]} continue
- if {[info exists ref($id)]} continue
- set ref($id) $id
- lappend ignorenew "^$id"
- }
-
- foreach a $old_args {
- if {![info exists ref($a)]} {
- lappend ignorenew $a
- }
- }
-
- set phase updatecommits
- set oldcommits $commits
- set commits {}
- set removed_commits [split [eval exec git-rev-list $ignorenew] "\n" ]
- if {[llength $removed_commits] > 0} {
- allcanvs delete all
- foreach c $removed_commits {
- set i [lsearch -exact $oldcommits $c]
- if {$i >= 0} {
- set oldcommits [lreplace $oldcommits $i $i]
- unset commitlisted($c)
- foreach p $parents($c) {
- if {[info exists nchildren($p)]} {
- set j [lsearch -exact $children($p) $c]
- if {$j >= 0} {
- set children($p) [lreplace $children($p) $j $j]
- incr nchildren($p) -1
- }
- }
- }
- }
- }
- set phase removecommits
- }
-
- set args {}
- foreach a $parsed_args {
- if {![info exists oldref($a)]} {
- lappend args $a
- }