Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added -fine option for fine grained change chunks, useful for merging. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
35053e21fcb18cc6ccbac0a5cf99ff0f |
User & Date: | peter.spjuth@gmail.com 2011-04-27 23:13:43.000 |
Context
2011-04-28
| ||
00:21 | Code cleanup to get clean Nagelfar run check-in: 4d66d4009f user: peter.spjuth@gmail.com tags: trunk | |
2011-04-27
| ||
23:13 | Added -fine option for fine grained change chunks, useful for merging. check-in: 35053e21fc user: peter.spjuth@gmail.com tags: trunk | |
22:20 | Restructured code to let insertMatchingBlocks handle puting changes in the change list. check-in: bd368726a8 user: peter.spjuth@gmail.com tags: trunk | |
Changes
Changes to Changes.
1 2 3 4 5 6 7 | 2011-04-24 Added basic GUI for plugin selection. 2011-04-22 Merging did not work properly if alignement was used. [Bug 9925] 2011-04-11 | > > > | 1 2 3 4 5 6 7 8 9 10 | 2011-04-28 Added three-way merge. Cmd line options -a and -fine. 2011-04-24 Added basic GUI for plugin selection. 2011-04-22 Merging did not work properly if alignement was used. [Bug 9925] 2011-04-11 |
︙ | ︙ |
Changes to doc/cmdline.txt.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | -prefix <str> : Care mainly about words starting with "str". -preprocess <pair> : TBW -r <ver> : Version info for version control mode. -cvs : Detect CVS first, if multiple version systems are used. -svn : Detect SVN first, if multiple version systems are used. -conflict : Treat file as a merge conflict file and enter merge mode. -o <file> : Specify merge result output file. -browse : Automatically bring up file dialog after starting. -server : Set up Eskil to be controllable from the outside. -print <file> : Generate PDF and exit. -printCharsPerLine <n> : Adapt font size for this line length and wrap. (80) -printPaper <paper> : Select paper size (a4) | > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | -prefix <str> : Care mainly about words starting with "str". -preprocess <pair> : TBW -r <ver> : Version info for version control mode. -cvs : Detect CVS first, if multiple version systems are used. -svn : Detect SVN first, if multiple version systems are used. -a <file> : Give anscestor file for three way merge. -conflict : Treat file as a merge conflict file and enter merge mode. -o <file> : Specify merge result output file. -fine : Use fine grained chunks. Useful for merging. -browse : Automatically bring up file dialog after starting. -server : Set up Eskil to be controllable from the outside. -print <file> : Generate PDF and exit. -printCharsPerLine <n> : Adapt font size for this line length and wrap. (80) -printPaper <paper> : Select paper size (a4) |
︙ | ︙ |
Changes to src/eskil.tcl.
︙ | ︙ | |||
366 367 368 369 370 371 372 | incr doingLine2 } # Detect if only newlines has changed within the block, e.g. # when rearranging newlines. # Rearranging newlines in comment blocks usually leads to # words moving across "*", ignore * too. | | > | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | incr doingLine2 } # Detect if only newlines has changed within the block, e.g. # when rearranging newlines. # Rearranging newlines in comment blocks usually leads to # words moving across "*", ignore * too. # Returns 0 if the block in not handled here, non-zero if the block is done, # negative if the block is considered not a change. proc ParseBlocksAcrossNewline {top block1 block2} { global doingLine1 doingLine2 set map {{ } {} \t {}} set RE {\n\s*\*?|\s} set equal 0 set visible [expr {$::eskil(ignorenewline) == 1}] |
︙ | ︙ | |||
446 447 448 449 450 451 452 | return [expr {($n1 > $n2 ? $n1 : $n2) + 1}] } else { return [expr {-($n1 > $n2 ? $n1 : $n2)}] } } # Insert two blocks of lines in the compare windows. | < < | > < | > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | < > < | 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 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | return [expr {($n1 > $n2 ? $n1 : $n2) + 1}] } else { return [expr {-($n1 > $n2 ? $n1 : $n2)}] } } # Insert two blocks of lines in the compare windows. proc insertMatchingBlocks {top block1 block2 line1 line2 details} { global doingLine1 doingLine2 # A large block may take time. Give a small warning. set n1 [llength $block1] set n2 [llength $block2] if {$n1 * $n2 > 1000} { set ::widgets($top,eqLabel) "!" #puts "Eskil warning: Analyzing a large block. ($size1 $size2)" update idletasks } # Detect if only newlines has changed within the block, e.g. # when rearranging newlines. if {$::eskil(ignorenewline)} { set res [ParseBlocksAcrossNewline $top $block1 $block2] if {$res != 0} { # FIXA: move this to ParseBlocksAcrossNewline ? if {$res > 0 && $details} { addChange $top $res change $line1 $n1 $line2 $n2 nextHighlight $top } else { addMapLines $top [expr {abs($res)}] } return } } set apa [compareBlocks $block1 $block2] # Fine grained changes means that each line is considered its own # chunk. This is used for merging better to avoid the same decision # for an entire block. set finegrain [expr {$::Pref(finegrainchunks) && $details}] set t1 0 set t2 0 foreach c $apa { if {$c eq "c"} { set textline1 [lindex $block1 $t1] set textline2 [lindex $block2 $t2] insertMatchingLines $top $textline1 $textline2 if {$finegrain} { addChange $top 1 change [expr {$line1 + $t1}] 1 \ [expr {$line2 + $t2}] 1 nextHighlight $top } incr t1 incr t2 } elseif {$c eq "C"} { # This is two lines that the block matching considered # too different to use line parsing on them. # Marked the whole line as deleted/inserted set textline1 [lindex $block1 $t1] set textline2 [lindex $block2 $t2] $::widgets($top,wLine1) insert end [myFormL $doingLine1] \ "hl$::HighLightCount change" $::widgets($top,wDiff1) insert end "$textline1\n" new1 $::widgets($top,wLine2) insert end [myFormL $doingLine2] \ "hl$::HighLightCount change" $::widgets($top,wDiff2) insert end "$textline2\n" new2 if {$finegrain} { addChange $top 1 change [expr {$line1 + $t1}] 1 \ [expr {$line2 + $t2}] 1 nextHighlight $top } incr doingLine1 incr doingLine2 incr t1 incr t2 } elseif {$c eq "d"} { set bepa [lindex $block1 $t1] $::widgets($top,wLine1) insert end [myFormL $doingLine1] \ "hl$::HighLightCount change" $::widgets($top,wDiff1) insert end "$bepa\n" new1 emptyLine $top 2 incr doingLine1 if {$finegrain} { addChange $top 1 new1 [expr {$line1 + $t1}] 1 \ [expr {$line2 + $t2}] 0 nextHighlight $top } incr t1 } elseif {$c eq "a"} { set bepa [lindex $block2 $t2] $::widgets($top,wLine2) insert end [myFormL $doingLine2] \ "hl$::HighLightCount change" $::widgets($top,wDiff2) insert end "$bepa\n" new2 emptyLine $top 1 incr doingLine2 if {$finegrain} { addChange $top 1 new2 [expr {$line1 + $t1}] 0 \ [expr {$line2 + $t2}] 1 nextHighlight $top } incr t2 } } if {!$finegrain} { if {$details} { addChange $top [llength $apa] change $line1 $n1 $line2 $n2 nextHighlight $top } else { addMapLines $top [llength $apa] } } } # Process one of the change/add/delete blocks reported by diff. # ch1 is a file channel for the left file # ch2 is a file channel for the right file # n1/n2 is the number of lines involved # line1/line2 says on what lines this block starts # If n1/n2 are both 0, it means that this is the last lines to be displayed. # In that case line1/line2, if non-zero says the last line to display. proc doText {top ch1 ch2 n1 n2 line1 line2} { global doingLine1 doingLine2 Pref if {$n1 == 0 && $n2 == 0} { # All blocks have been processed. Continue until end of file. # If "show all" is not on, just display a couple of context lines. set limit -1 |
︙ | ︙ | |||
573 574 575 576 577 578 579 | while {[gets $ch1 apa] != -1} { if {$line1 > 0 && $doingLine1 > $line1} break insertLine $top 1 $doingLine1 $apa incr doingLine1 incr t if {$limit >= 0 && $t >= $limit} break } | | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | while {[gets $ch1 apa] != -1} { if {$line1 > 0 && $doingLine1 > $line1} break insertLine $top 1 $doingLine1 $apa incr doingLine1 incr t if {$limit >= 0 && $t >= $limit} break } return } # Is this a change block, a delete block or a insert block? if {$n1 == 0} {set tag2 new2} else {set tag2 change} if {$n2 == 0} {set tag1 new1} else {set tag1 change} # Display all equal lines before next diff |
︙ | ︙ | |||
615 616 617 618 619 620 621 | } } incr doingLine1 incr doingLine2 incr t if {$::diff($top,limitlines) && \ ($::diff($top,mapMax) > $::diff($top,limitlines))} { | | | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | } } incr doingLine1 incr doingLine2 incr t if {$::diff($top,limitlines) && \ ($::diff($top,mapMax) > $::diff($top,limitlines))} { return } } # This should not happen unless something is wrong... if {$doingLine2 != $line2} { disallowEdit $top $::widgets($top,wDiff1) insert end \ "**Bad alignment here!! $doingLine2 $line2**\n" |
︙ | ︙ | |||
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | gets $ch2 textline2 insertMatchingLines $top $textline1 $textline2 } if {$::diff(filter) != "" && $::diff(filterflag)} { addMapLines $top $n1 } else { addChange $top $n1 change $line1 $n1 $line2 $n2 } } else { if {$n1 != 0 && $n2 != 0 && $Pref(parse) >= 2 && \ ($n1 * $n2 < 1000 || $Pref(parse) == 3)} { # Full block parsing set block1 {} for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa lappend block1 $apa } set block2 {} for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa lappend block2 $apa } | > | < < < < > > | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | gets $ch2 textline2 insertMatchingLines $top $textline1 $textline2 } if {$::diff(filter) != "" && $::diff(filterflag)} { addMapLines $top $n1 } else { addChange $top $n1 change $line1 $n1 $line2 $n2 nextHighlight $top } } else { if {$n1 != 0 && $n2 != 0 && $Pref(parse) >= 2 && \ ($n1 * $n2 < 1000 || $Pref(parse) == 3)} { # Full block parsing set block1 {} for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa lappend block1 $apa } set block2 {} for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa lappend block2 $apa } insertMatchingBlocks $top $block1 $block2 $line1 $line2 1 } else { # No extra parsing at all. for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa insertLine $top 1 $doingLine1 $apa $tag1 incr doingLine1 } for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa insertLine $top 2 $doingLine2 $apa $tag2 incr doingLine2 } if {$n1 <= $n2} { for {set t $n1} {$t < $n2} {incr t} { emptyLine $top 1 } addChange $top $n2 $tag2 $line1 $n1 $line2 $n2 nextHighlight $top } elseif {$n2 < $n1} { for {set t $n2} {$t < $n1} {incr t} { emptyLine $top 2 } addChange $top $n1 $tag1 $line1 $n1 $line2 $n2 nextHighlight $top } } } # Empty return value return } proc enableRedo {top} { $top.m.mf entryconfigure "Redo Diff" -state normal $top.m.mt entryconfigure "Merge" -state normal } |
︙ | ︙ | |||
1328 1329 1330 1331 1332 1333 1334 | incr doingLine2 } } set t 0 foreach i $diffres { lassign $i line1 n1 line2 n2 | | < < < < | 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | incr doingLine2 } } set t 0 foreach i $diffres { lassign $i line1 n1 line2 n2 doText $top $ch1 $ch2 $n1 $n2 $line1 $line2 if {$::diff($top,limitlines) && \ ($::diff($top,mapMax) > $::diff($top,limitlines))} { break } # Get one update when the screen has been filled. # Show the first diff. if {$firstview && $::diff($top,mapMax) > 100} { set firstview 0 showDiff $top 0 update idletasks |
︙ | ︙ | |||
2316 2317 2318 2319 2320 2321 2322 | if {!$tmp1 && $tmp2} {.lpm delete last} set ::diff($top,nopopup) 1 tk_popup .lpm $X $Y after idle [list after 1 [list set ::diff($top,nopopup) 0]] } | | > | 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | if {!$tmp1 && $tmp2} {.lpm delete last} set ::diff($top,nopopup) 1 tk_popup .lpm $X $Y after idle [list after 1 [list set ::diff($top,nopopup) 0]] } proc nextHighlight {top} { set tag hl$::HighLightCount foreach n {1 2} { $::widgets($top,wLine$n) tag bind $tag <ButtonPress-3> \ "hlPopup $top $n $::HighLightCount %X %Y %x %y ; break" $::widgets($top,wLine$n) tag bind $tag <ButtonPress-1> \ "hlSelect $top $::HighLightCount" } incr ::HighLightCount } ######### # Zooming ######### proc zoomRow {w X Y x y} { |
︙ | ︙ | |||
2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 | -value 2 $top.m.mo.p add radiobutton -label "Blocks" -variable Pref(parse) -value 3 $top.m.mo.p add separator $top.m.mo.p add radiobutton -label "Characters" \ -variable Pref(lineparsewords) -value "0" $top.m.mo.p add radiobutton -label "Words" \ -variable Pref(lineparsewords) -value "1" $top.m.mo.p add separator $top.m.mo.p add checkbutton -label "Mark last" -variable Pref(marklast) menu $top.m.mo.c $top.m.mo.c add radiobutton -label "Show all lines" \ -variable ::Pref(context) -value -1 $top.m.mo.c add radiobutton -label "Show only diffs" \ | > > | 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 | -value 2 $top.m.mo.p add radiobutton -label "Blocks" -variable Pref(parse) -value 3 $top.m.mo.p add separator $top.m.mo.p add radiobutton -label "Characters" \ -variable Pref(lineparsewords) -value "0" $top.m.mo.p add radiobutton -label "Words" \ -variable Pref(lineparsewords) -value "1" $top.m.mo.p add separator $top.m.mo.p add checkbutton -label "Fine chunks" -variable Pref(finegrainchunks) $top.m.mo.p add separator $top.m.mo.p add checkbutton -label "Mark last" -variable Pref(marklast) menu $top.m.mo.c $top.m.mo.c add radiobutton -label "Show all lines" \ -variable ::Pref(context) -value -1 $top.m.mo.c add radiobutton -label "Show only diffs" \ |
︙ | ︙ | |||
3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 | -prefix <str> : Care mainly about words starting with "str". -preprocess <pair> : TBW -r <ver> : Version info for version control mode. -cvs : Detect CVS first, if multiple version systems are used. -svn : Detect SVN first, if multiple version systems are used. -conflict : Treat file as a merge conflict file and enter merge mode. -o <file> : Specify merge result output file. -browse : Automatically bring up file dialog after starting. -server : Set up Eskil to be controllable from the outside. -print <file> : Generate PDF and exit. -printCharsPerLine <n> : Adapt font size for this line length and wrap. (80) -printPaper <paper> : Select paper size (a4) | > > | 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 | -prefix <str> : Care mainly about words starting with "str". -preprocess <pair> : TBW -r <ver> : Version info for version control mode. -cvs : Detect CVS first, if multiple version systems are used. -svn : Detect SVN first, if multiple version systems are used. -a <file> : Give anscestor file for three way merge. -conflict : Treat file as a merge conflict file and enter merge mode. -o <file> : Specify merge result output file. -fine : Use fine grained chunks. Useful for merging. -browse : Automatically bring up file dialog after starting. -server : Set up Eskil to be controllable from the outside. -print <file> : Generate PDF and exit. -printCharsPerLine <n> : Adapt font size for this line length and wrap. (80) -printPaper <paper> : Select paper size (a4) |
︙ | ︙ | |||
3489 3490 3491 3492 3493 3494 3495 | set allOpts { -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix -noparse -line -smallblock -block -char -word -limit -nodiff -dir -clip -patch -browse -conflict -print -printHeaderSize -printCharsPerLine -printPaper -printColorChange -printColorOld -printColorNew | | | 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 | set allOpts { -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix -noparse -line -smallblock -block -char -word -limit -nodiff -dir -clip -patch -browse -conflict -print -printHeaderSize -printCharsPerLine -printPaper -printColorChange -printColorOld -printColorNew -server -o -a -fine -r -context -cvs -svn -review -foreach -preprocess -close -nonewline -plugin -plugininfo -plugindump -pluginlist } # If the first option is "--query", use it to ask about options. if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} { set arg [lindex $::eskil(argv) 1] |
︙ | ︙ | |||
3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 | package require Tk tk appname Eskil } } elseif {$arg eq "-o"} { set nextArg mergeFile } elseif {$arg eq "-a"} { set nextArg ancestorFile } elseif {$arg eq "-r"} { set nextArg revision } elseif {$arg eq "-debug"} { set ::eskil(debug) 1 } elseif {$arg eq "-svn"} { set preferedRev "SVN" } elseif {$arg eq "-cvs"} { | > > | 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 | package require Tk tk appname Eskil } } elseif {$arg eq "-o"} { set nextArg mergeFile } elseif {$arg eq "-a"} { set nextArg ancestorFile } elseif {$arg eq "-fine"} { set Pref(finegrainchunks) 1 } elseif {$arg eq "-r"} { set nextArg revision } elseif {$arg eq "-debug"} { set ::eskil(debug) 1 } elseif {$arg eq "-svn"} { set preferedRev "SVN" } elseif {$arg eq "-cvs"} { |
︙ | ︙ | |||
3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 | set Pref(colornew1) darkgreen set Pref(colornew2) blue set Pref(bgequal) "" set Pref(bgchange) \#ffe0e0 set Pref(bgnew1) \#a0ffa0 set Pref(bgnew2) \#e0e0ff set Pref(context) -1 set Pref(marklast) 1 set Pref(linewidth) 80 set Pref(lines) 60 set Pref(editor) "" set Pref(regsub) {} set Pref(toolbar) 0 set Pref(wideMap) 0 ;# Not settable in GUI yet | > | 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 | set Pref(colornew1) darkgreen set Pref(colornew2) blue set Pref(bgequal) "" set Pref(bgchange) \#ffe0e0 set Pref(bgnew1) \#a0ffa0 set Pref(bgnew2) \#e0e0ff set Pref(context) -1 set Pref(finegrainchunks) 0 set Pref(marklast) 1 set Pref(linewidth) 80 set Pref(lines) 60 set Pref(editor) "" set Pref(regsub) {} set Pref(toolbar) 0 set Pref(wideMap) 0 ;# Not settable in GUI yet |
︙ | ︙ |