|
|
@ -1936,7 +1936,7 @@ proc findfiles {} { |
|
|
|
global selectedline numcommits lineid ctext |
|
|
|
global selectedline numcommits lineid ctext |
|
|
|
global ffileline finddidsel parents nparents |
|
|
|
global ffileline finddidsel parents nparents |
|
|
|
global findinprogress findstartline findinsertpos |
|
|
|
global findinprogress findstartline findinsertpos |
|
|
|
global treediffs fdiffids fdiffsneeded fdiffpos |
|
|
|
global treediffs fdiffid fdiffsneeded fdiffpos |
|
|
|
global findmergefiles |
|
|
|
global findmergefiles |
|
|
|
|
|
|
|
|
|
|
|
if {$numcommits == 0} return |
|
|
|
if {$numcommits == 0} return |
|
|
@ -1953,11 +1953,9 @@ proc findfiles {} { |
|
|
|
while 1 { |
|
|
|
while 1 { |
|
|
|
set id $lineid($l) |
|
|
|
set id $lineid($l) |
|
|
|
if {$findmergefiles || $nparents($id) == 1} { |
|
|
|
if {$findmergefiles || $nparents($id) == 1} { |
|
|
|
foreach p $parents($id) { |
|
|
|
if {![info exists treediffs($id)]} { |
|
|
|
if {![info exists treediffs([list $id $p])]} { |
|
|
|
append diffsneeded "$id\n" |
|
|
|
append diffsneeded "$id $p\n" |
|
|
|
lappend fdiffsneeded $id |
|
|
|
lappend fdiffsneeded [list $id $p] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if {[incr l] >= $numcommits} { |
|
|
|
if {[incr l] >= $numcommits} { |
|
|
@ -1974,7 +1972,7 @@ proc findfiles {} { |
|
|
|
error_popup "Error starting search process: $err" |
|
|
|
error_popup "Error starting search process: $err" |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
catch {unset fdiffids} |
|
|
|
catch {unset fdiffid} |
|
|
|
set fdiffpos 0 |
|
|
|
set fdiffpos 0 |
|
|
|
fconfigure $df -blocking 0 |
|
|
|
fconfigure $df -blocking 0 |
|
|
|
fileevent $df readable [list readfilediffs $df] |
|
|
|
fileevent $df readable [list readfilediffs $df] |
|
|
@ -1983,16 +1981,15 @@ proc findfiles {} { |
|
|
|
set finddidsel 0 |
|
|
|
set finddidsel 0 |
|
|
|
set findinsertpos end |
|
|
|
set findinsertpos end |
|
|
|
set id $lineid($l) |
|
|
|
set id $lineid($l) |
|
|
|
set p [lindex $parents($id) 0] |
|
|
|
|
|
|
|
. config -cursor watch |
|
|
|
. config -cursor watch |
|
|
|
settextcursor watch |
|
|
|
settextcursor watch |
|
|
|
set findinprogress 1 |
|
|
|
set findinprogress 1 |
|
|
|
findcont [list $id $p] |
|
|
|
findcont $id |
|
|
|
update |
|
|
|
update |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
proc readfilediffs {df} { |
|
|
|
proc readfilediffs {df} { |
|
|
|
global findids fdiffids fdiffs |
|
|
|
global findid fdiffid fdiffs |
|
|
|
|
|
|
|
|
|
|
|
set n [gets $df line] |
|
|
|
set n [gets $df line] |
|
|
|
if {$n < 0} { |
|
|
|
if {$n < 0} { |
|
|
@ -2002,19 +1999,19 @@ proc readfilediffs {df} { |
|
|
|
stopfindproc |
|
|
|
stopfindproc |
|
|
|
bell |
|
|
|
bell |
|
|
|
error_popup "Error in git-diff-tree: $err" |
|
|
|
error_popup "Error in git-diff-tree: $err" |
|
|
|
} elseif {[info exists findids]} { |
|
|
|
} elseif {[info exists findid]} { |
|
|
|
set ids $findids |
|
|
|
set id $findid |
|
|
|
stopfindproc |
|
|
|
stopfindproc |
|
|
|
bell |
|
|
|
bell |
|
|
|
error_popup "Couldn't find diffs for {$ids}" |
|
|
|
error_popup "Couldn't find diffs for $id" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if {[regexp {^([0-9a-f]{40}) \(from ([0-9a-f]{40})\)} $line match id p]} { |
|
|
|
if {[regexp {^([0-9a-f]{40})$} $line match id]} { |
|
|
|
# start of a new string of diffs |
|
|
|
# start of a new string of diffs |
|
|
|
donefilediff |
|
|
|
donefilediff |
|
|
|
set fdiffids [list $id $p] |
|
|
|
set fdiffid $id |
|
|
|
set fdiffs {} |
|
|
|
set fdiffs {} |
|
|
|
} elseif {[string match ":*" $line]} { |
|
|
|
} elseif {[string match ":*" $line]} { |
|
|
|
lappend fdiffs [lindex $line 5] |
|
|
|
lappend fdiffs [lindex $line 5] |
|
|
@ -2022,53 +2019,50 @@ proc readfilediffs {df} { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
proc donefilediff {} { |
|
|
|
proc donefilediff {} { |
|
|
|
global fdiffids fdiffs treediffs findids |
|
|
|
global fdiffid fdiffs treediffs findid |
|
|
|
global fdiffsneeded fdiffpos |
|
|
|
global fdiffsneeded fdiffpos |
|
|
|
|
|
|
|
|
|
|
|
if {[info exists fdiffids]} { |
|
|
|
if {[info exists fdiffid]} { |
|
|
|
while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffids |
|
|
|
while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffid |
|
|
|
&& $fdiffpos < [llength $fdiffsneeded]} { |
|
|
|
&& $fdiffpos < [llength $fdiffsneeded]} { |
|
|
|
# git-diff-tree doesn't output anything for a commit |
|
|
|
# git-diff-tree doesn't output anything for a commit |
|
|
|
# which doesn't change anything |
|
|
|
# which doesn't change anything |
|
|
|
set nullids [lindex $fdiffsneeded $fdiffpos] |
|
|
|
set nullid [lindex $fdiffsneeded $fdiffpos] |
|
|
|
set treediffs($nullids) {} |
|
|
|
set treediffs($nullid) {} |
|
|
|
if {[info exists findids] && $nullids eq $findids} { |
|
|
|
if {[info exists findid] && $nullid eq $findid} { |
|
|
|
unset findids |
|
|
|
unset findid |
|
|
|
findcont $nullids |
|
|
|
findcont $nullid |
|
|
|
} |
|
|
|
} |
|
|
|
incr fdiffpos |
|
|
|
incr fdiffpos |
|
|
|
} |
|
|
|
} |
|
|
|
incr fdiffpos |
|
|
|
incr fdiffpos |
|
|
|
|
|
|
|
|
|
|
|
if {![info exists treediffs($fdiffids)]} { |
|
|
|
if {![info exists treediffs($fdiffid)]} { |
|
|
|
set treediffs($fdiffids) $fdiffs |
|
|
|
set treediffs($fdiffid) $fdiffs |
|
|
|
} |
|
|
|
} |
|
|
|
if {[info exists findids] && $fdiffids eq $findids} { |
|
|
|
if {[info exists findid] && $fdiffid eq $findid} { |
|
|
|
unset findids |
|
|
|
unset findid |
|
|
|
findcont $fdiffids |
|
|
|
findcont $fdiffid |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
proc findcont {ids} { |
|
|
|
proc findcont {id} { |
|
|
|
global findids treediffs parents nparents |
|
|
|
global findid treediffs parents nparents |
|
|
|
global ffileline findstartline finddidsel |
|
|
|
global ffileline findstartline finddidsel |
|
|
|
global lineid numcommits matchinglines findinprogress |
|
|
|
global lineid numcommits matchinglines findinprogress |
|
|
|
global findmergefiles |
|
|
|
global findmergefiles |
|
|
|
|
|
|
|
|
|
|
|
set id [lindex $ids 0] |
|
|
|
|
|
|
|
set p [lindex $ids 1] |
|
|
|
|
|
|
|
set pi [lsearch -exact $parents($id) $p] |
|
|
|
|
|
|
|
set l $ffileline |
|
|
|
set l $ffileline |
|
|
|
while 1 { |
|
|
|
while 1 { |
|
|
|
if {$findmergefiles || $nparents($id) == 1} { |
|
|
|
if {$findmergefiles || $nparents($id) == 1} { |
|
|
|
if {![info exists treediffs($ids)]} { |
|
|
|
if {![info exists treediffs($id)]} { |
|
|
|
set findids $ids |
|
|
|
set findid $id |
|
|
|
set ffileline $l |
|
|
|
set ffileline $l |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
set doesmatch 0 |
|
|
|
set doesmatch 0 |
|
|
|
foreach f $treediffs($ids) { |
|
|
|
foreach f $treediffs($id) { |
|
|
|
set x [findmatches $f] |
|
|
|
set x [findmatches $f] |
|
|
|
if {$x != {}} { |
|
|
|
if {$x != {}} { |
|
|
|
set doesmatch 1 |
|
|
|
set doesmatch 1 |
|
|
@ -2077,21 +2071,13 @@ proc findcont {ids} { |
|
|
|
} |
|
|
|
} |
|
|
|
if {$doesmatch} { |
|
|
|
if {$doesmatch} { |
|
|
|
insertmatch $l $id |
|
|
|
insertmatch $l $id |
|
|
|
set pi $nparents($id) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
set pi $nparents($id) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if {[incr pi] >= $nparents($id)} { |
|
|
|
if {[incr l] >= $numcommits} { |
|
|
|
set pi 0 |
|
|
|
set l 0 |
|
|
|
if {[incr l] >= $numcommits} { |
|
|
|
|
|
|
|
set l 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if {$l == $findstartline} break |
|
|
|
|
|
|
|
set id $lineid($l) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
set p [lindex $parents($id) $pi] |
|
|
|
if {$l == $findstartline} break |
|
|
|
set ids [list $id $p] |
|
|
|
set id $lineid($l) |
|
|
|
} |
|
|
|
} |
|
|
|
stopfindproc |
|
|
|
stopfindproc |
|
|
|
if {!$finddidsel} { |
|
|
|
if {!$finddidsel} { |
|
|
|