Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch table-list Through [0f4c63dfb2] Excluding Merge-Ins
This is equivalent to a diff from ab1da68c44 to 0f4c63dfb2
2010-11-07
| ||
20:19 | Autodetect line endings in conflict file. Allow line ending selection in merge save. [FR 5160] Added menu bar to merge window. check-in: a2cdf2901b user: peter.spjuth@gmail.com tags: trunk | |
2010-06-23
| ||
22:34 | Make sure Restart is only scheduled once. check-in: 07f2a54ef5 user: peter.spjuth@gmail.com tags: table-list | |
21:28 | Removed Name columns from dir diff. check-in: 0f4c63dfb2 user: peter.spjuth@gmail.com tags: table-list | |
21:23 | Remade hidden columns into row attributes. check-in: 79b9aabf5f user: peter.spjuth@gmail.com tags: table-list | |
20:34 | Trying out to use tablelist instead of ttk::treeview for dir diff. check-in: 17bdab9a27 user: peter.spjuth@gmail.com tags: table-list | |
20:33 | Support -noempty from DiffUtil. check-in: ab1da68c44 user: peter.spjuth@gmail.com tags: trunk | |
20:31 | Get DiffUtil from new location. check-in: fab6204614 user: peter.spjuth@gmail.com tags: trunk | |
Changes to src/dirdiff.tcl.
1 2 3 | #---------------------------------------------------------------------- # Eskil, Directory diff section # | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #---------------------------------------------------------------------- # Eskil, Directory diff section # # Copyright (c) 1998-2010, Peter Spjuth (peter.spjuth@gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- package require tablelist_tile # Compare file names proc FStrCmp {s1 s2} { # Equality is based on platform's standard # Order is dictionary order # Exact equal is equal regardless of platform. |
︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | if {$newdir != ""} { set dir $newdir $entryW xview end } } snit::widget DirCompareTree { component tree component hsb component vsb option -leftdirvariable -default "" -configuremethod SetDirOption option -rightdirvariable -default "" -configuremethod SetDirOption option -statusvar -default "" variable AfterId "" variable PauseBgProcessing 0 variable IdleQueue {} variable IdleQueueArr variable leftMark "" variable rightMark "" variable leftDir "" variable rightDir "" constructor {args} { | > > | < | < | | < < < < < < < | | | | | | | | | | | > | > > > | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | if {$newdir != ""} { set dir $newdir $entryW xview end } } snit::widget DirCompareTree { hulltype ttk::frame component tree component hsb component vsb option -leftdirvariable -default "" -configuremethod SetDirOption option -rightdirvariable -default "" -configuremethod SetDirOption option -statusvar -default "" variable AfterId "" variable PauseBgProcessing 0 variable IdleQueue {} variable IdleQueueArr variable leftMark "" variable rightMark "" variable leftDir "" variable rightDir "" constructor {args} { variable color install tree using tablelist::tablelist $win.tree -height 20 \ -movablecolumns no -setgrid no -showseparators yes \ -columns {0 "Structure" 0 Size 0 Date 0 Size 0 Date} install vsb using scrollbar $win.vsb -orient vertical \ -command "$tree yview" install hsb using scrollbar $win.hsb -orient horizontal \ -command "$tree xview" set AfterId "" set IdleQueue {} $tree configure -yscrollcommand "$vsb set" -xscrollcommand "$hsb set" $tree columnconfigure 0 -name structure $tree columnconfigure 1 -name leftsize -align right $tree columnconfigure 2 -name leftdate $tree columnconfigure 3 -name rightsize -align right $tree columnconfigure 4 -name rightdate set color(unknown) grey set color(empty) grey set color(equal) {} set color(new) green set color(old) blue set color(change) red #-expandcommand expandCmd #bind $tree <<TreeviewOpen>> "[mymethod UpdateDirNode] \[%W focus\]" set bodyTag [$tree bodytag] bind $bodyTag <<Button3>> [bind TablelistBody <Button-1>] bind $bodyTag <<Button3>> +[bind TablelistBody <ButtonRelease-1>] bind $bodyTag <<Button3>> "+[mymethod ContextMenu] %W %x %y %X %Y" bind $bodyTag <Double-1> "[mymethod DoubleClick] %W %x %y" bind $bodyTag <Key-Return> [mymethod KeyReturn] grid $tree $vsb -sticky nsew grid $hsb -sticky nsew grid columnconfigure $win 0 -weight 1 grid rowconfigure $win 0 -weight 1 $self configurelist $args |
︙ | ︙ | |||
348 349 350 351 352 353 354 | after cancel $AfterId } set AfterId "" set IdleQueue {} array unset IdleQueueArr # Fill in clean root data | | > > > > > > > > | | | < | < | | | | > | < < | < | < < < < < | | | | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 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 411 412 413 414 415 416 417 | after cancel $AfterId } set AfterId "" set IdleQueue {} array unset IdleQueueArr # Fill in clean root data $tree delete 0 end set topIndex [$tree insertchild root end {}] set d1 [file tail $leftDir] set d2 [file tail $rightDir] if {$d1 eq $d2} { $tree cellconfigure $topIndex,structure -text $d1 } else { $tree cellconfigure $topIndex,structure -text "$d1 vs $d2" } $tree rowattrib $topIndex type directory $self SetNodeStatus $topIndex empty $tree rowattrib $topIndex leftfull $leftDir $tree rowattrib $topIndex rightfull $rightDir $self UpdateDirNode $topIndex } # Format a time stamp for display proc FormatDate {date} { clock format $date -format "%Y-%m-%d %H:%M:%S" } # Remove all equal nodes from tree method PruneEqual {} { set todo [$tree childkeys root] while {[llength $todo] > 0} { set todoNow $todo set todo {} foreach node $todoNow { set status [$tree rowattrib $node status] if {$status eq "equal"} { $tree delete $node } else { lappend todo {*}[$tree childkeys $node] } } } } # Open or close all directories in the tree view method OpenAll {{state 1}} { if {$state} { $tree expandall } else { $tree collapseall } } # Copy a file from one directory to the other method CopyFile {node from} { global dirdiff Pref set lf [$tree rowattrib $node leftfull] set rf [$tree rowattrib $node rightfull] set parent [$tree parent $node] set lp [$tree rowattrib $parent leftfull] set rp [$tree rowattrib $parent rightfull] if {$from eq "left"} { set src $lf if {$rf ne ""} { set dst $rf } elseif {$rp ne ""} { set dst [file join $rp [file tail $src]] |
︙ | ︙ | |||
447 448 449 450 451 452 453 | # FIXA: update file info in tree too $self SetNodeStatus $node equal } } } # React on double-click | | > | | | | | | | | | | | | | | | | | | 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 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 | # FIXA: update file info in tree too $self SetNodeStatus $node equal } } } # React on double-click method DoubleClick {W x y} { foreach {W x y} [tablelist::convEventFields $W $x $y] break set node [$tree index @$x,$y] set lf [$tree rowattrib $node leftfull] set rf [$tree rowattrib $node rightfull] set type [$tree rowattrib $node type] # On a file that exists on both sides, start a file diff if {$type eq "file" && $lf ne "" && $rf ne ""} { set PauseBgProcessing 1 newDiff $lf $rf set PauseBgProcessing 0 # Stop the default bindings from running return -code break } } # React on Return key method KeyReturn {} { set node [$tree focus] if {$node eq ""} return set lf [$tree rowattrib $node leftfull] set rf [$tree rowattrib $node rightfull] set type [$tree rowattrib $node type] # On a file that exists on both sides, start a file diff if {$type eq "file" && $lf ne "" && $rf ne ""} { set PauseBgProcessing 1 newDiff $lf $rf set PauseBgProcessing 0 # Stop the default bindings from running return -code break } } # Bring up a context menu on a file. method ContextMenu {W x y X Y} { foreach {W x y} [tablelist::convEventFields $W $x $y] break set node [$tree index @$x,$y] set col [$tree columnindex @$x,$y] set colname [$tree columncget $col -name] set lf [$tree rowattrib $node leftfull] set rf [$tree rowattrib $node rightfull] set type [$tree rowattrib $node type] set oneside [expr {($lf ne "") ^ ($rf ne "")}] set m $win.popup destroy $m menu $m if {$colname eq "structure"} { $m add command -label "Prune equal" -command [mymethod PruneEqual] $m add command -label "Expand all" -command [mymethod OpenAll] $m add command -label "Collapse all" -command [mymethod OpenAll 0] } if {$type eq "file" && $lf ne "" && $rf ne ""} { # Files, both exist $m add command -label "Compare Files" -command [list \ newDiff $lf $rf] } |
︙ | ︙ | |||
580 581 582 583 584 585 586 | set pre [clock clicks -milliseconds] set errors {} while {[llength $IdleQueue] > 0} { set node [lindex $IdleQueue 0] set IdleQueue [lrange $IdleQueue 1 end] unset IdleQueueArr($node) | | | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | set pre [clock clicks -milliseconds] set errors {} while {[llength $IdleQueue] > 0} { set node [lindex $IdleQueue 0] set IdleQueue [lrange $IdleQueue 1 end] unset IdleQueueArr($node) if {[$tree rowattrib $node type] ne "directory"} { set sts [catch {$self UpdateFileNode $node} err] } else { set sts [catch {$self UpdateDirNode $node} err] } if {$sts} { lappend errors $err } |
︙ | ︙ | |||
612 613 614 615 616 617 618 | set statusvar "" set AfterId "" return } } if {[llength $IdleQueue] > 0} { | | | > | | > | | | | | | < > < | | | | | | | < < < < < < < < | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 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 | set statusvar "" set AfterId "" return } } if {[llength $IdleQueue] > 0} { set leftfull [$tree rowattrib $node leftfull] set rightfull [$tree rowattrib $node rightfull] if {$leftfull ne ""} { set statusvar $leftfull } else { set statusvar $rightfull } set AfterId [after 1 [mymethod UpdateIdle]] } else { set statusvar "" set AfterId "" } } method SetNodeStatus {node status} { variable color $tree rowattrib $node status $status $tree rowconfigure $node -foreground $color($status) \ -selectforeground $color($status) #puts "Set [$tree item $node -text] to $status" # Loop through children to update parent set parent [$tree parentkey $node] if {$parent eq "" || $parent eq "root"} { return } # If this is only present on one side, there is no need to update set lf [$tree rowattrib $parent leftfull] set rf [$tree rowattrib $parent rightfull] if {$lf eq "" || $rf eq ""} { return } set pstatus equal foreach child [$tree childkeys $parent] { set status [$tree rowattrib $child status] switch $status { unknown { set pstatus unknown } new - old - change { set pstatus change break } } } $self SetNodeStatus $parent $pstatus } method UpdateDirNode {node} { if {[$tree rowattrib $node type] ne "directory"} { return } if {[$tree rowattrib $node status] ne "empty"} { #puts "Dir [$tree set $node leftfull] already done" return } $tree delete [$tree childkeys $node] set leftfull [$tree rowattrib $node leftfull] set rightfull [$tree rowattrib $node rightfull] $self CompareDirs $leftfull $rightfull $node } method UpdateFileNode {node} { set leftfull [$tree rowattrib $node leftfull] set rightfull [$tree rowattrib $node rightfull] set equal [CompareFiles $leftfull $rightfull] if {$equal} { $self SetNodeStatus $node equal } else { $self SetNodeStatus $node change } } # List files under a directory node # Returns status for the new node method ListFiles {df1 df2 node} { if {$df1 ne ""} { set type [file type $df1] |
︙ | ︙ | |||
717 718 719 720 721 722 723 | set size2 "" set time2 "" } else { set size2 $stat2(size) set time2 [FormatDate $stat2(mtime)] } if {$type eq "directory"} { | < < < < < < < < < | | | < < | | | | > > > > | > | | | | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | set size2 "" set time2 "" } else { set size2 $stat2(size) set time2 [FormatDate $stat2(mtime)] } if {$type eq "directory"} { set values [list $name \ "" "" \ "" ""] } else { set values [list $name \ $size1 $time1 \ $size2 $time2] } set id [$tree insertchild $node end $values] $tree rowattrib $id type $type $tree rowattrib $id status unknown $tree rowattrib $id leftfull $df1 $tree rowattrib $id rightfull $df2 if {$type eq "directory"} { ## Make it so that this node is openable $tree collapse $id #$tree insertchild $id end dummy ;# a dummy $tree cellconfigure $id,structure -text $name/ $self SetNodeStatus $id empty $self AddNodeToIdle $id } elseif {$size1 == $size2 && \ $time1 == $time2} { $self SetNodeStatus $id equal } elseif {$size1 == ""} { $self SetNodeStatus $id new } elseif {$size2 == ""} { $self SetNodeStatus $id old } else { $self SetNodeStatus $id unknown $self AddNodeToIdle $id } return [$tree rowattrib $id status] } # Compare two directories. method CompareDirs {dir1 dir2 node} { global Pref if {$dir1 eq ""} { set files1 {} |
︙ | ︙ |