Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved compareBlocks a bit for the case of same number of lines. Clear map and set eqLabel to "*" during external diff execution. Fixed a big in -limit. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c8952314db6d7774d12105bf98963738 |
User & Date: | spjutp 2002-03-15 14:44:21.000 |
Context
2002-04-09
| ||
15:52 | Added no directory option. Exclude CVS from recursion. check-in: 97b879f13e user: spjutp tags: trunk | |
2002-03-15
| ||
14:44 | Improved compareBlocks a bit for the case of same number of lines. Clear map and set eqLabel to "*" during external diff execution. Fixed a big in -limit. check-in: c8952314db user: spjutp tags: trunk | |
2002-03-11
| ||
13:34 | Added -limit option. Fixed bug where a skipped large block did not show up in map. Added 'C' to prettyprint options. check-in: d787c9f604 user: spjutp tags: trunk | |
Changes
Changes to src/eskil.tcl.
︙ | ︙ | |||
49 50 51 52 53 54 55 | # #----------------------------------------------- # $Revision$ #----------------------------------------------- # the next line restarts using wish \ exec wish "$0" "$@" | | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # #----------------------------------------------- # $Revision$ #----------------------------------------------- # the next line restarts using wish \ exec wish "$0" "$@" set debug 1 set diffver "Version 1.9.4b 2002-03-15" set tmpcnt 0 set tmpfiles {} set thisscript [file join [pwd] [info script]] set thisdir [file dirname $thisscript] set diffexe diff |
︙ | ︙ | |||
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | set apa [string length $diff] incr sumdiff1 $apa } foreach diff $diffs2 { set apa [string length $diff] incr sumdiff2 $apa } # puts "S $sumsame D $sumdiff1 D $sumdiff2" return [expr {$sumsame - [maxabs $sumdiff1 $sumdiff2]}] } # Decide how to display change blocks # This tries to match the lines that resemble each other and put them # next to each other. # As the previous procedure, this would need a complete rework and a # better algorithm. | > > > | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | set apa [string length $diff] incr sumdiff1 $apa } foreach diff $diffs2 { set apa [string length $diff] incr sumdiff2 $apa } # puts "Same ($sames)" # puts "D1 ($diffs1)" # puts "D2 ($diffs2)" # puts "S $sumsame D $sumdiff1 D $sumdiff2" return [expr {$sumsame - [maxabs $sumdiff1 $sumdiff2]}] } # Decide how to display change blocks # This tries to match the lines that resemble each other and put them # next to each other. # As the previous procedure, this would need a complete rework and a # better algorithm. proc compareBlocks {block1 block2} { set size1 [llength $block1] set size2 [llength $block2] if {$size1 * $size2 > 1000} { puts "Diff warning: Analyzing a large block. ($size1 $size2)" update idletasks } |
︙ | ︙ | |||
440 441 442 443 444 445 446 447 | } # puts "Best for $j is $bestline : $bestscore" set origresult($j) $bestline set scores(best,$j) $bestscore incr bestsum $bestscore incr j } | > > > > > > > > > > > > | > > < > | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | } # puts "Best for $j is $bestline : $bestscore" set origresult($j) $bestline set scores(best,$j) $bestscore incr bestsum $bestscore incr j } # puts "Bestsum: $bestsum" array set bestresult [array get origresult] set bestscoresum -100000 # First try the simplest match, as a base if {$size1 > 1 && $size1 == $size2} { set sum 0 array unset result for {set i 0} {$i < $size1} {incr i} { set result($i) $i incr sum $scores($i,$i) } # puts "Simple map sum: $sum" array set bestresult [array get result] set bestscoresum $sum } # If result is in order, no problem. # Otherwise, try to adjust result to make it ordered if {$size1 > 1} { while {1} { array unset result array set result [array get origresult] for {set i 0} {$i < $size1} {incr i} { set mark($i) 0 } while {1} { set besti 0 set bestscore -100000 |
︙ | ︙ | |||
515 516 517 518 519 520 521 | for {set i 0} {$i < $size1} {incr i} { set j $result($i) if {[info exists scores($i,$j)]} { # puts "Score: $i $j $scores($i,$j)" incr scoresum $scores($i,$j) } } | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | for {set i 0} {$i < $size1} {incr i} { set j $result($i) if {[info exists scores($i,$j)]} { # puts "Score: $i $j $scores($i,$j)" incr scoresum $scores($i,$j) } } # puts "Scoresum: $scoresum ($bestscoresum)" if {$scoresum > $bestscoresum} { array set bestresult [array get result] set bestscoresum $scoresum if {$bestscoresum >= (3 * $bestsum / 4)} { break } # If the result seems too bad, try again but |
︙ | ︙ | |||
638 639 640 641 642 643 644 | incr doingLine2 } # Returns number of lines used to display the blocks proc insertMatchingBlocks {block1 block2} { global doingLine1 doingLine2 | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | incr doingLine2 } # Returns number of lines used to display the blocks proc insertMatchingBlocks {block1 block2} { global doingLine1 doingLine2 set apa [compareBlocks $block1 $block2] set t1 0 set t2 0 foreach c $apa { if {$c == "c"} { set textline1 [lindex $block1 $t1] set textline2 [lindex $block2 $t2] |
︙ | ︙ | |||
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | $w configure -state normal $w delete 1.0 end } set changesList {} set mapMax 0 set ::HighLightCount 0 highLightChange -1 update idletasks if {$diff(mode) == "patch"} { displayPatch drawMap -1 foreach w {.ft1.tl .ft2.tl} { | > > | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | $w configure -state normal $w delete 1.0 end } set changesList {} set mapMax 0 set ::HighLightCount 0 highLightChange -1 drawMap -1 set ::diff(eqLabel) "*" update idletasks if {$diff(mode) == "patch"} { displayPatch drawMap -1 foreach w {.ft1.tl .ft2.tl} { |
︙ | ︙ | |||
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | dotext $ch1 $ch2 $n1 $n2 $line1 $line2 } d { # lucka i right, new i left dotext $ch1 $ch2 $n1 0 $line1 [expr {$line2 + 1}] } } } if {[incr t] >= 10} { update idletasks .ft2.tl see end update idletasks set t 0 } | > > > | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 | dotext $ch1 $ch2 $n1 $n2 $line1 $line2 } d { # lucka i right, new i left dotext $ch1 $ch2 $n1 0 $line1 [expr {$line2 + 1}] } } } if {$::diff(limitlines) && $::mapMax > $::diff(limitlines)} { break } if {[incr t] >= 10} { update idletasks .ft2.tl see end update idletasks set t 0 } |
︙ | ︙ |