Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Undid all dirdiff refactoring from August. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
47893ccebc6e9f540600b08e8a50a769 |
User & Date: | peter 2014-11-13 20:44:45.977 |
Context
2014-11-13
| ||
20:46 | Syntax check fix check-in: ba2ce3d1bc user: peter tags: trunk | |
20:44 | Undid all dirdiff refactoring from August. check-in: 47893ccebc user: peter tags: trunk | |
20:31 | Web update for 2.6.7 check-in: 6839402dbd user: peter tags: trunk | |
Changes
Changes to Changes.
1 2 3 4 5 6 7 | 2014-11-12 Bumped revision to 2.6.7 2014-11-12 Added vcsvfs, to be used for revision aware dirdiff. 2014-11-07 | > > > | 1 2 3 4 5 6 7 8 9 10 | 2014-11-13 Undid all dirdiff refactoring from August. Bad idea... 2014-11-12 Bumped revision to 2.6.7 2014-11-12 Added vcsvfs, to be used for revision aware dirdiff. 2014-11-07 |
︙ | ︙ |
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 | if {[lindex [lsort -dictionary [list $s1 $s2]] 0] eq $s1} { return -1 } return 1 } # Compare two files or dirs # Return true if equal | > > > > > | | | < < < < < < < < | | | < < < < | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | if {[lindex [lsort -dictionary [list $s1 $s2]] 0] eq $s1} { return -1 } return 1 } # Sort file names proc Fsort {l} { lsort -dictionary $l } # Compare two files or dirs # Return true if equal proc CompareFiles {file1 file2} { if {[catch {file lstat $file1 stat1}]} { return 0 } if {[catch {file lstat $file2 stat2}]} { return 0 } # Same type? set isdir1 [FileIsDirectory $file1] set isdir2 [FileIsDirectory $file2] if {$isdir1 != $isdir2} { return 0 } # Handle links if {$stat1(type) eq "link" && $stat2(type) eq "link"} { set l1 [file link $file1] set l2 [file link $file2] # Equal links are considered equal, otherwise check contents if {$l1 eq $l2} { return 1 } file stat $file1 stat1 file stat $file2 stat2 } # If contents is not checked, same size is enough to be equal if {$stat1(size) == $stat2(size) && $::Pref(dir,comparelevel) == 0} { return 1 } set ignorekey $::Pref(dir,ignorekey) # Different size is enough when doing binary compare if {$stat1(size) != $stat2(size) && $::Pref(dir,comparelevel) == 2 \ && !$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 if {$::Pref(dir,comparelevel) == 0} { return 0 } # Don't check further if any is a directory |
︙ | ︙ | |||
149 150 151 152 153 154 155 | close $ch1 close $ch2 } } return $eq } | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | < > | | | | < < > > | < | | > | | | | < | | | | | | | | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | close $ch1 close $ch2 } } return $eq } # Returns the contents of a directory as a sorted list of full file paths. proc DirContents {dir} { if {$::tcl_platform(platform) eq "windows"} { # .-files are not treated specially on windows. * is enough to get all set files [glob -directory $dir -nocomplain *] } else { set files [glob -directory $dir -nocomplain * {.[a-zA-Z]*}] } if {$::Pref(dir,onlyrev)} { # FIXA: move to rev and make general for other systems set entries [file join $dir CVS Entries] if {[file exists $entries]} { set ch [open $entries r] set data [read $ch] close $ch foreach line [split $data \n] { set name [lindex [split $line /] 1] set controlled($name) 1 } set files2 {} foreach file $files { if {[info exists controlled($file)]} { lappend files2 $file } } set files $files2 } } set files2 {} foreach file $files { set full $file set tail [file tail $file] # Apply filters if {[FileIsDirectory $full]} { if {[llength $::Pref(dir,incdirs)] == 0} { set allowed 1 } else { set allowed 0 foreach pat $::Pref(dir,incdirs) { if {[string match $pat $tail]} { set allowed 1 break } } } if {$allowed} { foreach pat $::Pref(dir,exdirs) { if {[string match $pat $tail]} { set allowed 0 break } } } if {!$allowed} continue } else { if {[llength $::Pref(dir,incfiles)] == 0} { set allowed 1 } else { set allowed 0 foreach pat $::Pref(dir,incfiles) { if {[string match $pat $tail]} { set allowed 1 break } } } if {$allowed} { foreach pat $::Pref(dir,exfiles) { if {[string match $pat $tail]} { set allowed 0 break } } } if {!$allowed} continue } lappend files2 $full } return [Fsort $files2] } # Bring up an editor to display a file. proc EditFile {file} { locateEditor ::util(editor) exec $::util(editor) $file & } |
︙ | ︙ | |||
432 433 434 435 436 437 438 | $tree cellconfigure $topIndex,structure -text $d1 } else { $tree cellconfigure $topIndex,structure -text "$d1 vs $d2" } $tree cellconfigure $topIndex,structure -image $::img(open) $tree rowattrib $topIndex type directory $self SetNodeStatus $topIndex empty | | < | < | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | $tree cellconfigure $topIndex,structure -text $d1 } else { $tree cellconfigure $topIndex,structure -text "$d1 vs $d2" } $tree cellconfigure $topIndex,structure -image $::img(open) $tree rowattrib $topIndex type directory $self SetNodeStatus $topIndex empty $tree rowattrib $topIndex leftfull $leftDir $tree rowattrib $topIndex rightfull $rightDir $self UpdateDirNode $topIndex } method expandCmd {tbl row} { if {[$tree childcount $row] != 0} { $tree cellconfigure $row,0 -image $::img(open) |
︙ | ︙ | |||
778 779 780 781 782 783 784 | set leftfull [$tree rowattrib $node leftfull] set rightfull [$tree rowattrib $node rightfull] $self CompareDirs $leftfull $rightfull $node } method UpdateFileNode {node} { | | | | | < | < | | | < | < | | | | 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 769 770 771 772 773 774 775 776 777 778 779 780 | 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 {[catch {file stat $df1 stat1}]} { set size1 "" set time1 "" set type1 "" } else { set size1 $stat1(size) set time1 [FormatDate $stat1(mtime)] set type1 $stat1(type) } if {[catch {file stat $df2 stat2}]} { set size2 "" set time2 "" set type2 "" } else { set size2 $stat2(size) set time2 [FormatDate $stat2(mtime)] set type2 $stat2(type) } if {$df1 ne ""} { set type $type1 set name [file tail $df1] } else { set type $type2 set name [file tail $df2] |
︙ | ︙ | |||
835 836 837 838 839 840 841 | "" \ $size2 $time2] } set id [$tree insertchild $node end $values] $tree rowattrib $id type $type $tree rowattrib $id status unknown $tree rowattrib $id leftfull $df1 | < < | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | "" \ $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 ne "directory"} { if {$type eq "link"} { $tree cellconfigure $id,structure -image $::img(link) } else { $tree cellconfigure $id,structure -image $::img(file) $tree cellconfigure $id,command -window [mymethod addCmdCol] } |
︙ | ︙ | |||
894 895 896 897 898 899 900 | if {$rf eq ""} { $w.bl configure -state disabled } } # Compare two directories. method CompareDirs {dir1 dir2 node} { | < < < < < < < | | | | | | | > | > | | | | | | | | | | | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | if {$rf eq ""} { $w.bl configure -state disabled } } # Compare two directories. method CompareDirs {dir1 dir2 node} { if {$dir1 eq ""} { set files1 {} } else { set files1 [DirContents $dir1] } if {$dir2 eq ""} { set files2 {} } else { set files2 [DirContents $dir2] } set len1 [llength $files1] set len2 [llength $files2] set p1 0 set p2 0 set status_change 0 set status_unknown 0 while 1 { if {$p1 < $len1 && $p2 < $len2} { set df1 [lindex $files1 $p1] set f1 [file tail $df1] set df2 [lindex $files2 $p2] set f2 [file tail $df2] set apa [FStrCmp $f1 $f2] if {$apa == 0} { # Equal names, separate them if not the same type set apa [expr {- [FileIsDirectory $df1] \ + [FileIsDirectory $df2]}] } switch -- $apa { 0 { set sts [$self ListFiles $df1 $df2 $node] incr p1 incr p2 if {$sts eq "unknown"} { set status_unknown 1 } } -1 { $self ListFiles $df1 "" $node incr p1 set status_change 1 } 1 { $self ListFiles "" $df2 $node incr p2 set status_change 1 } } } elseif {$p1 < $len1 && $p2 >= $len2} { set df1 [lindex $files1 $p1] $self ListFiles $df1 "" $node incr p1 set status_change 1 } elseif {$p1 >= $len1 && $p2 < $len2} { set df2 [lindex $files2 $p2] $self ListFiles "" $df2 $node incr p2 set status_change 1 } else { break } } if {$dir1 eq ""} { |
︙ | ︙ | |||
1229 1230 1231 1232 1233 1234 1235 | ttk::entryX $filter.e1 -width 20 -textvariable ::TmpPref(dir,incfiles) ttk::label $filter.l2 -text "Exclude Files" -anchor w ttk::entryX $filter.e2 -width 20 -textvariable ::TmpPref(dir,exfiles) ttk::label $filter.l3 -text "Include Dirs" -anchor w ttk::entryX $filter.e3 -width 20 -textvariable ::TmpPref(dir,incdirs) ttk::label $filter.l4 -text "Exclude Dirs" -anchor w ttk::entryX $filter.e4 -width 20 -textvariable ::TmpPref(dir,exdirs) | < | 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | ttk::entryX $filter.e1 -width 20 -textvariable ::TmpPref(dir,incfiles) ttk::label $filter.l2 -text "Exclude Files" -anchor w ttk::entryX $filter.e2 -width 20 -textvariable ::TmpPref(dir,exfiles) ttk::label $filter.l3 -text "Include Dirs" -anchor w ttk::entryX $filter.e3 -width 20 -textvariable ::TmpPref(dir,incdirs) ttk::label $filter.l4 -text "Exclude Dirs" -anchor w ttk::entryX $filter.e4 -width 20 -textvariable ::TmpPref(dir,exdirs) ttk::checkbutton $filter.cb1 -text "Only revision controlled" \ -variable ::TmpPref(dir,onlyrev) grid $filter.l1 $filter.e1 -sticky we -padx 3 -pady 3 grid $filter.l2 $filter.e2 -sticky we -padx 3 -pady 3 grid $filter.l3 $filter.e3 -sticky we -padx 3 -pady 3 grid $filter.l4 $filter.e4 -sticky we -padx 3 -pady 3 grid $filter.cb1 - -sticky w -padx 3 -pady 3 |
︙ | ︙ |