Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Started on dirdiff filters. Added dirdiff preferences dialog. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e3f42b8e0e47b3d99ed366d51f655097 |
User & Date: | peter 2007-01-28 12:57:19.000 |
Context
2007-01-28
| ||
12:58 | Removed ddtoolbar, added dirdiff filter preferences. check-in: b7d1ae61a5 user: peter tags: trunk | |
12:57 | Started on dirdiff filters. Added dirdiff preferences dialog. check-in: e3f42b8e0e user: peter tags: trunk | |
2007-01-10
| ||
21:02 | Moved merge to separate source file. check-in: d3a7f91085 user: peter tags: trunk | |
Changes
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
55 56 57 58 59 60 61 | return 0 } # If contents is not checked, same size is enough to be equal if {$stat1(size) == $stat2(size) && $Pref(comparelevel) == 0} { return 1 } # Different size is enough when doing binary compare | | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | return 0 } # If contents is not checked, same size is enough to be equal if {$stat1(size) == $stat2(size) && $Pref(comparelevel) == 0} { return 1 } # Different size is enough when doing binary compare if {$stat1(size) != $stat2(size) && $Pref(comparelevel) eq "1b" \ && !$ignorekey} { return 0 } # Same size and time is always considered equal if {$stat1(size) == $stat2(size) && $stat1(mtime) == $stat2(mtime)} { return 1 } # Don't check further if contents should not be checked |
︙ | ︙ | |||
114 115 116 117 118 119 120 | if {![eof $ch1] || ![eof $ch2]} { set eq 0 } close $ch1 close $ch2 } 2 { # Simple external diff | | | | < < < < < < < < | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | if {![eof $ch1] || ![eof $ch2]} { set eq 0 } close $ch1 close $ch2 } 2 { # Simple external diff set eq [expr {![catch {exec $::util(diffexe) -q $file1 $file2}]}] } 3 { # Ignore space set eq [expr {![catch {exec $::util(diffexe) -q -w $file1 $file2}]}] } 4 { # Ignore case set eq [expr {![catch {exec $::util(diffexe) -q -i $file1 $file2}]}] } } return $eq } # Display two files in the directory windows and set up info for # interacting with them. # diff: Do they differ. # level: Depth in a recursive run. # The values in infoFiles are: # 1 = noLeft, 2 = noRight, 4 = left is dir, 8 = right is dir, 16 = diff proc ListFiles {df1 df2 diff level} { global dirdiff Pref lappend dirdiff(leftFiles) $df1 lappend dirdiff(rightFiles) $df2 set info [expr {$diff? 16 : 0}] if {$df1 eq ""} { incr info 1 } if {$df2 eq ""} { |
︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 | $dirdiff(wLeft) insert end [format "%-30s %8d %16s\n" \ $f1 $size \ [clock format $mtime -format "%Y-%m-%d %H:%M"]] \ $tag1 } lappend dirdiff(infoFiles) $info } # Compare two directories. proc CompareDirs {dir1 dir2 {level 0}} { global Pref | > > > > > > > > > > > > > > > > > > > < | < | < < | 227 228 229 230 231 232 233 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 259 260 261 262 263 264 265 | $dirdiff(wLeft) insert end [format "%-30s %8d %16s\n" \ $f1 $size \ [clock format $mtime -format "%Y-%m-%d %H:%M"]] \ $tag1 } lappend dirdiff(infoFiles) $info } # Returns the contents of a directory as a sorted list of file tails. proc DirContents {dir} { set files [glob -tails -dir $dir -nocomplain * {.[a-zA-Z]*}] set files2 {} foreach file $files { # Simple static filter for now if {[FileIsDirectory $file]} { if {$::Pref(nodir)} continue if {$file eq "CVS"} continue } else { if {[string match "*.o" $file]} continue } lappend files2 $file } return [Fsort $files2] } # Compare two directories. proc CompareDirs {dir1 dir2 {level 0}} { global Pref set files1 [DirContents $dir1] set files2 [DirContents $dir2] set len1 [llength $files1] set len2 [llength $files2] set p1 0 set p2 0 while 1 { |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 | } switch -- $apa { 0 { set diff [expr {![CompareFiles $df1 $df2]}] if {$diff || !$Pref(dir,onlydiffs)} { ListFiles $df1 $df2 $diff $level } if {[FileIsDirectory $df1] && [FileIsDirectory $df2] && \ $Pref(recursive) && [file tail $df1] != "CVS"} { CompareDirs $df1 $df2 [expr {$level + 1}] } incr p1 incr p2 } | > | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | } switch -- $apa { 0 { set diff [expr {![CompareFiles $df1 $df2]}] if {$diff || !$Pref(dir,onlydiffs)} { ListFiles $df1 $df2 $diff $level } # FIXA CVS should be filtered properly if {[FileIsDirectory $df1] && [FileIsDirectory $df2] && \ $Pref(recursive) && [file tail $df1] != "CVS"} { CompareDirs $df1 $df2 [expr {$level + 1}] } incr p1 incr p2 } |
︙ | ︙ | |||
548 549 550 551 552 553 554 555 556 557 558 559 560 561 | -command [list cleanupAndExit $top] $top.m.mf add separator $top.m.mf add command -label "Quit" -underline 0 \ -command [list cleanupAndExit all] $top.m add cascade -menu $top.m.mo -label "Preferences" -underline 0 menu $top.m.mo $top.m.mo add checkbutton -variable Pref(recursive) -label "Recursive" $top.m.mo add cascade -label "Check" -menu $top.m.mo.mc $top.m.mo add checkbutton -variable Pref(dir,onlydiffs) -label "Diffs Only" $top.m.mo add checkbutton -variable Pref(nodir) -label "No Directory" $top.m.mo add checkbutton -variable Pref(autocompare) -label "Auto Compare" menu $top.m.mo.mc | > | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | -command [list cleanupAndExit $top] $top.m.mf add separator $top.m.mf add command -label "Quit" -underline 0 \ -command [list cleanupAndExit all] $top.m add cascade -menu $top.m.mo -label "Preferences" -underline 0 menu $top.m.mo $top.m.mo add command -label "Prefs..." -command makeDirDiffPrefWin $top.m.mo add checkbutton -variable Pref(recursive) -label "Recursive" $top.m.mo add cascade -label "Check" -menu $top.m.mo.mc $top.m.mo add checkbutton -variable Pref(dir,onlydiffs) -label "Diffs Only" $top.m.mo add checkbutton -variable Pref(nodir) -label "No Directory" $top.m.mo add checkbutton -variable Pref(autocompare) -label "Auto Compare" menu $top.m.mo.mc |
︙ | ︙ | |||
658 659 660 661 662 663 664 | set dirdiff(wY) $top.sby # Interact better with diff by setting these set ::widgets($top,wDiff1) $top.t1 set ::widgets($top,wDiff2) $top.t2 applyColor | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 756 757 758 759 760 761 762 763 764 765 766 767 768 | set dirdiff(wY) $top.sby # Interact better with diff by setting these set ::widgets($top,wDiff1) $top.t1 set ::widgets($top,wDiff2) $top.t2 applyColor grid $top.fm - - - -sticky we grid $top.fe1 x x $top.fe2 -sticky we grid $top.t1 $map $top.sby $top.t2 -sticky news grid $top.sbx1 x x $top.sbx2 -sticky we grid $map -pady [expr {[$top.sby cget -width] + 2}] grid rowconfigure $top 2 -weight 1 grid columnconfigure $top {0 3} -weight 1 } # Transfer preferences from dialog to real settings proc ApplyDirDiffPref {} { foreach item { recursive dir,onlydiffs nodir autocompare comparelevel dir,ignorekey } { set ::Pref($item) $::TmpPref($item) } } # Create directory diff preferences window. proc makeDirDiffPrefWin {} { set top .dirdiffprefs if {[winfo exists $top] && [winfo toplevel $top] eq $top} { raise $top focus -force $top return } else { destroy $top toplevel $top -padx 3 -pady 3 foreach item { recursive dir,onlydiffs nodir autocompare comparelevel dir,ignorekey } { set ::TmpPref($item) $::Pref($item) } } wm title $top "Eskil Directory Preferences" set check [labelframe $top.check -text "Check" -padx 3 -pady 3] radiobutton $check.rb1 -variable TmpPref(comparelevel) -value 0 \ -text "Do not check contents" radiobutton $check.rb2 -variable TmpPref(comparelevel) -value 1 \ -text "Internal compare" radiobutton $check.rb3 -variable TmpPref(comparelevel) -value 1b \ -text "Internal compare (bin)" radiobutton $check.rb4 -variable TmpPref(comparelevel) -value 2 \ -text "Use Diff" radiobutton $check.rb5 -variable TmpPref(comparelevel) -value 3 \ -text "Diff, ignore blanks" radiobutton $check.rb6 -variable TmpPref(comparelevel) -value 4 \ -text "Diff, ignore case" grid $check.rb1 $check.rb4 -sticky w -padx 3 -pady 3 grid $check.rb2 $check.rb5 -sticky w -padx 3 -pady 3 grid $check.rb3 $check.rb6 -sticky w -padx 3 -pady 3 grid columnconfigure $check {0 1 2} -uniform a -weight 1 set opts [labelframe $top.opts -text "Options" -padx 3 -pady 3] checkbutton $opts.cb1 -variable TmpPref(dir,ignorekey) \ -text "Ignore \$Keyword:\$" checkbutton $opts.cb2 -variable TmpPref(recursive) -text "Recursive" checkbutton $opts.cb3 -variable TmpPref(dir,onlydiffs) -text "Diffs Only" checkbutton $opts.cb4 -variable TmpPref(nodir) -text "No Directory" checkbutton $opts.cb5 -variable TmpPref(autocompare) -text "Auto Compare" eval pack [winfo children $opts] -side top -anchor w set fb [frame $top.fb -padx 3 -pady 3] button $fb.ok -width 10 -text "Ok" \ -command "ApplyDirDiffPref ; destroy $top" button $fb.ap -width 10 -text "Apply" -command ApplyDirDiffPref button $fb.ca -width 10 -text "Cancel" -command "destroy $top" grid $fb.ok $fb.ap $fb.ca -padx 3 -pady 3 grid columnconfigure $fb {0 1 2} -uniform a -weight 1 pack $fb -side bottom -fill x pack $check $opts -side top -fill x } # Experimental... proc makeRegSubWin {} { set top .ddregsub if {[winfo exists $top] && [winfo toplevel $top] eq $top} { raise $top |
︙ | ︙ |