Eskil

Check-in [e8c33e9a2c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support -norun for dir diff. Prune empty directories in dir diff. Added -includefile/dir command line, for dir diff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e8c33e9a2ca9150d569e0f504d761bdc42cbfba51817fd0710da7fdccda897a3
User & Date: peter 2020-01-15 14:15:06
Context
2020-02-15
23:44
Syntax fix Leaf check-in: 60dc0dc612 user: peter tags: trunk
2020-01-15
14:15
Support -norun for dir diff. Prune empty directories in dir diff. Added -includefile/dir command line, for dir diff. check-in: e8c33e9a2c user: peter tags: trunk
2020-01-07
10:06
Handle multiple screens better for balloon help check-in: 62ba2f60a5 user: peter tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/dirdiff.tcl.

306
307
308
309
310
311
312

313
314
315
316
317
318
319
...
436
437
438
439
440
441
442

443
444
445
446
447
448
449
450
451





452
453
454
455
456
457
458
...
524
525
526
527
528
529
530



























531
532
533
534
535
536
537
...
693
694
695
696
697
698
699

700
701
702
703
704
705
706
....
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
....
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
....
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
    component hsb
    component vsb

    option -leftdirvariable  -default "" -configuremethod SetDirOption
    option -rightdirvariable -default "" -configuremethod SetDirOption
    option -statusvar -default ""
    option -changelist -default ""


    variable AfterId ""
    variable DebugCh ""
    variable DebugTime {}
    variable PauseBgProcessing 0
    variable ScheduledRestart 0
    variable AfterTime 1
................................................................................
            after cancel $AfterId
        }
        if {$DebugCh ne ""} {
            close $DebugCh
            set DebugCh ""
            set DebugTime {}
        }

        # Uncomment to activate debug logging
        #set DebugCh [open ~/dirdiff.log a]
        #$self DlogTablelist
        $self Dlog RESTART
        set AfterId ""
        set IdleQueue {}
        set ScheduledRestart 0
        array unset IdleQueueArr
        set protect {left 0 right 0}






        # Directory Diff only supports one plugin.
        # Find if any configured plugin supports dir diff and choose it.
        set ::eskil(.dirdiff,dirPlugin) 0
        foreach item [lsort -dictionary [array names ::eskil .dirdiff,pluginname,*]] {
            set n [lindex [split $item ","] end]
            if {$::eskil(.dirdiff,plugin,$n) ne "" && \
................................................................................
                set status $NodeStatus($node)
                if {$status eq "equal"} {
                    $tree delete $node
                } else {
                    lappend todo {*}[$tree childkeys $node]
                }
            }



























        }
        $self normalCursor
    }

    # Open or close all directories in the tree view
    method OpenAll {{state 1}} {
        if {$state} {
................................................................................

        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 \
................................................................................

snit::widget DirDiff {
    hulltype toplevel
    widgetclass Toplevel
    component tree
    variable statusVar

    constructor {args} {
        eskilRegisterToplevel $win
        wm title $win "Eskil Dir"
        wm protocol $win WM_DELETE_WINDOW [list cleanupAndExit $win]

        install tree using DirCompareTree $win.dc \
                -leftdirvariable ::dirdiff(leftDir) \
                -rightdirvariable ::dirdiff(rightDir) \

                -statusvar [myvar statusVar]

        if {[info exists ::dirdiff(localChanges)]} {
            $tree configure -changelist $::dirdiff(localChanges)
        }

        ttk::frame $win.fe1
................................................................................
    grid $top.l1 $top.e1 -sticky we
    grid $top.l2 $top.e2 -sticky we
    grid columnconfigure $top 1 -weight 1
    grid rowconfigure    $top 2 -weight 1

}

proc makeDirDiffWin {} {
    if { ! [info exists ::dirdiff(leftDir)]} {
        set ::dirdiff(leftDir) ""
    }
    if { ! [info exists ::dirdiff(rightDir)]} {
        set ::dirdiff(rightDir) ""
    }
    # TODO, multi plugin for dirdiff?
................................................................................
                set ::dirdiff(rightDir) $d2
            }
            destroy .dirdiffX
        }
    }

    destroy .dirdiff
    DirDiff .dirdiff
    return .dirdiff
}







>







 







>









>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







 







|







>







 







|







 







|


306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
...
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
...
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
....
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
....
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
....
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
    component hsb
    component vsb

    option -leftdirvariable  -default "" -configuremethod SetDirOption
    option -rightdirvariable -default "" -configuremethod SetDirOption
    option -statusvar -default ""
    option -changelist -default ""
    option -norun -default 0

    variable AfterId ""
    variable DebugCh ""
    variable DebugTime {}
    variable PauseBgProcessing 0
    variable ScheduledRestart 0
    variable AfterTime 1
................................................................................
            after cancel $AfterId
        }
        if {$DebugCh ne ""} {
            close $DebugCh
            set DebugCh ""
            set DebugTime {}
        }

        # Uncomment to activate debug logging
        #set DebugCh [open ~/dirdiff.log a]
        #$self DlogTablelist
        $self Dlog RESTART
        set AfterId ""
        set IdleQueue {}
        set ScheduledRestart 0
        array unset IdleQueueArr
        set protect {left 0 right 0}

        if {$options(-norun)} {
            set options(-norun) 0
            return
        }

        # Directory Diff only supports one plugin.
        # Find if any configured plugin supports dir diff and choose it.
        set ::eskil(.dirdiff,dirPlugin) 0
        foreach item [lsort -dictionary [array names ::eskil .dirdiff,pluginname,*]] {
            set n [lindex [split $item ","] end]
            if {$::eskil(.dirdiff,plugin,$n) ne "" && \
................................................................................
                set status $NodeStatus($node)
                if {$status eq "equal"} {
                    $tree delete $node
                } else {
                    lappend todo {*}[$tree childkeys $node]
                }
            }
        }
        $self normalCursor
    }
    # Remove all empty dir nodes from tree
    method PruneEmpty {} {
        $self busyCursor
        set redo 1
        while {$redo} {
            set redo 0
            set todo [$tree childkeys root]
            while {[llength $todo] > 0} {
                set todoNow $todo
                set todo {}
                foreach node $todoNow {
                    set status $NodeStatus($node)
                    set children [$tree childkeys $node]
                    if {[llength $children] == 0} {
                        set type [$tree rowattrib $node type]
                        if {$type eq "directory"} {
                            $tree delete $node
                            set redo 1
                        }
                    } else {
                        lappend todo {*}$children
                    }
                }
            }
        }
        $self normalCursor
    }

    # Open or close all directories in the tree view
    method OpenAll {{state 1}} {
        if {$state} {
................................................................................

        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 "Prune empty" -command [mymethod PruneEmpty]
            $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 \
................................................................................

snit::widget DirDiff {
    hulltype toplevel
    widgetclass Toplevel
    component tree
    variable statusVar

    constructor {{noautodiff 0}} {
        eskilRegisterToplevel $win
        wm title $win "Eskil Dir"
        wm protocol $win WM_DELETE_WINDOW [list cleanupAndExit $win]

        install tree using DirCompareTree $win.dc \
                -leftdirvariable ::dirdiff(leftDir) \
                -rightdirvariable ::dirdiff(rightDir) \
                -norun $noautodiff \
                -statusvar [myvar statusVar]

        if {[info exists ::dirdiff(localChanges)]} {
            $tree configure -changelist $::dirdiff(localChanges)
        }

        ttk::frame $win.fe1
................................................................................
    grid $top.l1 $top.e1 -sticky we
    grid $top.l2 $top.e2 -sticky we
    grid columnconfigure $top 1 -weight 1
    grid rowconfigure    $top 2 -weight 1

}

proc makeDirDiffWin {{noautodiff 0}} {
    if { ! [info exists ::dirdiff(leftDir)]} {
        set ::dirdiff(leftDir) ""
    }
    if { ! [info exists ::dirdiff(rightDir)]} {
        set ::dirdiff(rightDir) ""
    }
    # TODO, multi plugin for dirdiff?
................................................................................
                set ::dirdiff(rightDir) $d2
            }
            destroy .dirdiffX
        }
    }

    destroy .dirdiff
    DirDiff .dirdiff $noautodiff
    return .dirdiff
}

Changes to src/startup.tcl.

771
772
773
774
775
776
777




778
779
780
781
782
783
784
....
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
    docFlag -printColorOld    "Color for old text (0.7 1.0 0.7)"
    docFlag -printColorNew    "Color for new text (0.8 0.8 1.0)"
    docFlag -printFont "Select font to use in PDF, afm or ttf. If <fontfile> is given as \"Courier\", PDF built in font is used"
    addPrefMultOpt -excludedir dir,exdirs
    docFlag    -excludedir "Exclude from directory diff"
    addPrefMultOpt -excludefile dir,exfiles
    docFlag    -excludefile "Exclude from directory diff"




    # These affect Pref but via special processing later
    addMultOpt -prefix
    docFlag    -prefix "Care mainly about words starting with <str>"
    addMultOpt -subst
    docFlag    -subst  "The <pair> is a list of Left+Right, used for subst preprocessing"
    addMultOpt -preprocess
    addMultOpt -preprocessleft
................................................................................

    # Figure out if we start in a diff or dirdiff window.
    set len [llength $files]

    if {$len == 0 && $dodir} {
        set dirdiff(leftDir) ""
        set dirdiff(rightDir) ""
        return [makeDirDiffWin]
    }
    if { ! $doreview && $len == 1} {
        set fullname [lindex $files 0]
        if {[FileIsDirectory $fullname 1]} {
            set dirdiff(leftDir) $fullname
            set dirdiff(rightDir) $dirdiff(leftDir)
            return [makeDirDiffWin]
        }
    } elseif { ! $doreview && $len >= 2} {
        set fullname1 [lindex $files 0]
        set fullname2 [lindex $files 1]
        if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
            set dirdiff(leftDir) $fullname1
            set dirdiff(rightDir) $fullname2
            return [makeDirDiffWin]
        }
    }

    # Ok, we have a normal diff
    set top [makeDiffWin]
    update








>
>
>
>







 







|






|







|







771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
....
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
    docFlag -printColorOld    "Color for old text (0.7 1.0 0.7)"
    docFlag -printColorNew    "Color for new text (0.8 0.8 1.0)"
    docFlag -printFont "Select font to use in PDF, afm or ttf. If <fontfile> is given as \"Courier\", PDF built in font is used"
    addPrefMultOpt -excludedir dir,exdirs
    docFlag    -excludedir "Exclude from directory diff"
    addPrefMultOpt -excludefile dir,exfiles
    docFlag    -excludefile "Exclude from directory diff"
    addPrefMultOpt -includedir dir,incdirs
    docFlag    -includedir "Include in directory diff"
    addPrefMultOpt -includefile dir,incfiles
    docFlag    -includefile "Include in directory diff"
    # These affect Pref but via special processing later
    addMultOpt -prefix
    docFlag    -prefix "Care mainly about words starting with <str>"
    addMultOpt -subst
    docFlag    -subst  "The <pair> is a list of Left+Right, used for subst preprocessing"
    addMultOpt -preprocess
    addMultOpt -preprocessleft
................................................................................

    # Figure out if we start in a diff or dirdiff window.
    set len [llength $files]

    if {$len == 0 && $dodir} {
        set dirdiff(leftDir) ""
        set dirdiff(rightDir) ""
        return [makeDirDiffWin $noautodiff]
    }
    if { ! $doreview && $len == 1} {
        set fullname [lindex $files 0]
        if {[FileIsDirectory $fullname 1]} {
            set dirdiff(leftDir) $fullname
            set dirdiff(rightDir) $dirdiff(leftDir)
            return [makeDirDiffWin $noautodiff]
        }
    } elseif { ! $doreview && $len >= 2} {
        set fullname1 [lindex $files 0]
        set fullname2 [lindex $files 1]
        if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
            set dirdiff(leftDir) $fullname1
            set dirdiff(rightDir) $fullname2
            return [makeDirDiffWin $noautodiff]
        }
    }

    # Ok, we have a normal diff
    set top [makeDiffWin]
    update