summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c461ff)
raw | patch | inline | side by side (parent: 3c461ff)
author | Paul Mackerras <paulus@dorrigo.(none)> | |
Wed, 20 Jul 2005 16:25:54 +0000 (12:25 -0400) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Wed, 20 Jul 2005 16:25:54 +0000 (12:25 -0400) |
gitk | patch | blob | history |
index 4cc59becd37bc0f83171905ab05d542dc650f2cc..112c9c0b60f9157a4556959396be4541a3e14963 100755 (executable)
--- a/gitk
+++ b/gitk
proc getblobdiffs {ids} {
global diffopts blobdifffd diffids env curdifftag curtagstart
- global diffindex difffilestart nextupdate diffinhdr
+ global difffilestart nextupdate diffinhdr treediffs
set id [lindex $ids 0]
set p [lindex $ids 1]
set blobdifffd($ids) $bdf
set curdifftag Comments
set curtagstart 0.0
- set diffindex 0
catch {unset difffilestart}
fileevent $bdf readable [list getblobdiffline $bdf $diffids]
set nextupdate [expr {[clock clicks -milliseconds] + 100}]
proc getblobdiffline {bdf ids} {
global diffids blobdifffd ctext curdifftag curtagstart
- global diffnexthead diffnextnote diffindex difffilestart
- global nextupdate diffinhdr
+ global diffnexthead diffnextnote difffilestart
+ global nextupdate diffinhdr treediffs
global gaudydiff
set n [gets $bdf line]
return
}
$ctext conf -state normal
- if {[regexp {^diff --git a/(.*) b/} $line match fname]} {
+ if {[regexp {^diff --git a/(.*) b/(.*)} $line match fname newname]} {
# start of a new file
$ctext insert end "\n"
$ctext tag add $curdifftag $curtagstart end
set curtagstart [$ctext index "end - 1c"]
- set header $fname
+ set header $newname
set here [$ctext index "end - 1c"]
- set difffilestart($diffindex) $here
- incr diffindex
- # start mark names at fmark.1 for first file
- $ctext mark set fmark.$diffindex $here
- $ctext mark gravity fmark.$diffindex left
+ set i [lsearch -exact $treediffs($diffids) $fname]
+ if {$i >= 0} {
+ set difffilestart($i) $here
+ incr i
+ $ctext mark set fmark.$i $here
+ $ctext mark gravity fmark.$i left
+ }
+ if {$newname != $fname} {
+ set i [lsearch -exact $treediffs($diffids) $newname]
+ if {$i >= 0} {
+ set difffilestart($i) $here
+ incr i
+ $ctext mark set fmark.$i $here
+ $ctext mark gravity fmark.$i left
+ }
+ }
set curdifftag "f:$fname"
$ctext tag delete $curdifftag
set l [expr {(78 - [string length $header]) / 2}]
set here [$ctext index @0,0]
for {set i 0} {[info exists difffilestart($i)]} {incr i} {
if {[$ctext compare $difffilestart($i) > $here]} {
- $ctext yview $difffilestart($i)
- break
+ if {![info exists pos]
+ || [$ctext compare $difffilestart($i) < $pos]} {
+ set pos $difffilestart($i)
+ }
}
}
+ if {[info exists pos]} {
+ $ctext yview $pos
+ }
}
proc listboxsel {} {
- global ctext cflist currentid treediffs
+ global ctext cflist currentid
if {![info exists currentid]} return
set sel [lsort [$cflist curselection]]
if {$sel eq {}} return