︙ | | |
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
|
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
|
-
+
-
+
-
-
+
+
+
+
+
+
+
|
}
return $eq
}
# Returns the contents of a directory as a sorted list of file dicts
# By collecting as much as possible in one place, this prepares for a
# future expansion into revision control support in dirdiff.
proc DirContentsDRaw {dir} {
proc DirContentsDRaw {dir prefsD} {
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]*}]
}
set result {}
foreach file [lsort -dictionary $files] {
set fD [dict create "full" $file]
dict set fD tail [file tail $file]
dict set fD dir [FileIsDirectory $file]
dict set fD "dir" [FileIsDirectory $file]
if {[catch {file stat $file stat}]} {
dict set fD size ""
dict set fD mtime ""
dict set fD type ""
} else {
dict set fD size $stat(size)
dict set fD mtime $stat(mtime)
dict set fD type $stat(type)
}
lappend result $fD
}
return $result
}
# Returns the contents of a directory as a sorted list of dicts, after applying
# filter preferences.
proc DirContentsD {dir} {
set filesD [DirContentsDRaw $dir]
proc DirContentsD {dir prefsD} {
set pIncDirs [dict get $prefsD incdirs]
set pExDirs [dict get $prefsD exdirs]
set pIncFiles [dict get $prefsD incfiles]
set pExFiles [dict get $prefsD exfiles]
set filesD [DirContentsDRaw $dir $prefsD]
if {$::Pref(dir,onlyrev)} {
# FIXA: move to rev and make general for other systems
# FIXA: obsolete, not updated since before dictinaries were used
#set entries [file join $dir CVS Entries]
#if {[file exists $entries]} {
# set ch [open $entries r]
|
︙ | | |
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
-
+
-
+
-
+
-
+
-
+
-
+
|
set filesD2 {}
foreach fileD $filesD {
set full [dict get $fileD full]
set tail [dict get $fileD tail]
set isDir [dict get $fileD "dir"]
# Apply filters
if {$isDir} {
if {[llength $::Pref(dir,incdirs)] == 0} {
if {[llength $pIncDirs] == 0} {
set allowed 1
} else {
set allowed 0
foreach pat $::Pref(dir,incdirs) {
foreach pat $pIncDirs {
if {[string match $pat $tail]} {
set allowed 1
break
}
}
}
if {$allowed} {
foreach pat $::Pref(dir,exdirs) {
foreach pat $pExDirs {
if {[string match $pat $tail]} {
set allowed 0
break
}
}
}
if {!$allowed} continue
} else {
if {[llength $::Pref(dir,incfiles)] == 0} {
if {[llength $pIncFiles] == 0} {
set allowed 1
} else {
set allowed 0
foreach pat $::Pref(dir,incfiles) {
foreach pat $pIncFiles {
if {[string match $pat $tail]} {
set allowed 1
break
}
}
}
if {$allowed} {
foreach pat $::Pref(dir,exfiles) {
foreach pat $pExFiles {
if {[string match $pat $tail]} {
set allowed 0
break
}
}
}
if {!$allowed} continue
|
︙ | | |
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
|
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
|
+
+
+
+
+
+
+
-
+
-
+
|
if {$rf eq ""} {
$w.bl configure -state disabled
}
}
# Compare two directories.
method CompareDirs {dir1 dir2 node} {
# Collect preferences to a dict.
# FIXA: Maybe move this to a more cnetral place
dict set prefsD incdirs $::Pref(dir,incdirs)
dict set prefsD exdirs $::Pref(dir,exdirs)
dict set prefsD incfiles $::Pref(dir,incfiles)
dict set prefsD exfiles $::Pref(dir,exfiles)
if {$dir1 eq ""} {
set filesD1 {}
} else {
set filesD1 [DirContentsD $dir1]
set filesD1 [DirContentsD $dir1 $prefsD]
}
if {$dir2 eq ""} {
set filesD2 {}
} else {
set filesD2 [DirContentsD $dir2]
set filesD2 [DirContentsD $dir2 $prefsD]
}
set len1 [llength $filesD1]
set len2 [llength $filesD2]
set p1 0
set p2 0
|
︙ | | |
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
|
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
|
+
|
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)
# FIXA: onlyrev currently does nothing
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
|
︙ | | |