Eskil

Diff
Login

Differences From Artifact [d016532490]:

To Artifact [a7320f1e2e]:


1
2

3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9

-
+







#!/bin/sh
#----------------------------------------------------------------------
#---------------------------------------------------------- -*- tcl -*-
#
#  Eskil, a Graphical frontend to diff
#
#  Copyright (c) 1998-2008, Peter Spjuth  (peter.spjuth@gmail.com)
#
#  Usage
#             Do 'eskil' for interactive mode
246
247
248
249
250
251
252
253

254
255
256
257
258
259
260
246
247
248
249
250
251
252

253
254
255
256
257
258
259
260







-
+







proc clearTmp {args} {
    if {![info exists ::tmpfiles]} {
        set ::tmpfiles {}
        return
    }
    if {[llength $args] > 0} {
        foreach f $args {
            set i [lsearch -exact $f $::tmpfiles]
            set i [lsearch -exact $::tmpfiles $f]
            if {$i >= 0} {
                catch {file delete $f}
                set ::tmpfiles [lreplace $::tmpfiles $i $i]
            }
        }
    } else {
        foreach f $::tmpfiles {
1053
1054
1055
1056
1057
1058
1059
1060

1061
1062
1063

1064
1065
1066
1067



1068
1069

1070
1071
1072
1073
1074
1075
1076
1077
1078





1079
1080
1081

1082
1083
1084

1085
1086

1087
1088
1089
1090
1091
1092
1093
1094
1095
1053
1054
1055
1056
1057
1058
1059

1060
1061
1062

1063
1064
1065


1066
1067
1068
1069

1070
1071
1072
1073
1074
1075




1076
1077
1078
1079
1080



1081



1082


1083


1084
1085
1086
1087
1088
1089
1090







-
+


-
+


-
-
+
+
+

-
+





-
-
-
-
+
+
+
+
+
-
-
-
+
-
-
-
+
-
-
+
-
-








#####################################
# Main diff
#####################################

# Prepare for a diff by creating needed temporary files
proc prepareFiles {top} {
    set ::diff($top,cleanup) ""
    set ::diff($top,cleanup) {}
    if {$::diff($top,mode) eq "rev"} {
        prepareRev $top
        set ::diff($top,cleanup) "rev"
        lappend ::diff($top,cleanup) "rev"
    } elseif {$::diff($top,mode) eq "conflict"} {
        prepareConflict $top
        set ::diff($top,cleanup) "conflict"
    } elseif {$::diff($top,plugin) ne ""} {
        lappend ::diff($top,cleanup) "conflict"
    }
    if {$::diff($top,plugin) ne ""} {
        preparePlugin $top
        set ::diff($top,cleanup) "plugin"
        set ::diff($top,cleanup) "plugin $::diff($top,cleanup)"
    }
}

# Clean up after a diff
proc cleanupFiles {top} {
    switch $::diff($top,cleanup) {
        "rev"       {cleanupRev      $top}
        "conflict"  {cleanupConflict $top}
        "plugin" {
    foreach keyword $::diff($top,cleanup) {
        switch $keyword {
            "rev"      {cleanupRev      $top}
            "conflict" {cleanupConflict $top}
            "plugin"   {cleanupPlugin   $top}
            if {[info exists ::diff($top,leftFileB)]} {
                set ::diff($top,leftFile) $::diff($top,leftFileB)
            }
        }
            if {[info exists ::diff($top,rightFileB)]} {
                set ::diff($top,rightFile) $::diff($top,rightFileB)
            }
    }
            unset -nocomplain ::diff($top,leftFileB) ::diff($top,rightFileB) \
                    ::diff($top,leftFileD) ::diff($top,rightFileD)
    set ::diff($top,cleanup) {}
        }
    }
}

# Redo Diff command
proc redoDiff {top} {
    # Note what rows are being displayed
    set w $::widgets($top,wDiff1)

1194
1195
1196
1197
1198
1199
1200

1201
1202


1203
1204
1205
1206
1207


1208
1209
1210
1211
1212
1213
1214
1189
1190
1191
1192
1193
1194
1195
1196


1197
1198
1199
1200
1201


1202
1203
1204
1205
1206
1207
1208
1209
1210







+
-
-
+
+



-
-
+
+







    }
    if {[llength $Pref(regsub)] > 0} {
        lappend opts -regsub $Pref(regsub)
    }
    # Apply nodigit after preprocess
    if {$Pref(nodigit)} {lappend opts -nodigit}

    # If a special file for diffing is present, use it. 
    if {[info exists ::diff($top,leftFileD)]} {
        set dFile1 $::diff($top,leftFileD)
    if {[info exists ::diff($top,leftFileDiff)]} {
        set dFile1 $::diff($top,leftFileDiff)
    } else {
        set dFile1 $::diff($top,leftFile)
    }
    if {[info exists ::diff($top,rightFileD)]} {
        set dFile2 $::diff($top,rightFileD)
    if {[info exists ::diff($top,rightFileDiff)]} {
        set dFile2 $::diff($top,rightFileDiff)
    } else {
        set dFile2 $::diff($top,rightFile)
    }

    set differr [catch {eval DiffUtil::diffFiles $opts \
            \$dFile1 \$dFile2} diffres]

2417
2418
2419
2420
2421
2422
2423

2424

2425
2426
2427
2428
2429
2430
2431
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429







+

+







    set ::diff($top,rightOK) 1
    set ::diff($top,mode) ""
    set ::diff($top,range) $range
    wm deiconify $top
    raise $top
    update
    doDiff $top
    return $top
}


# Create a new diff window equal to another, except for possibly a range
proc cloneDiff {other {range {}}} {
    set top [makeDiffWin]
    update

    foreach item [array names ::diff $other,*] {
2637
2638
2639
2640
2641
2642
2643
2644

2645
2646
2647
2648

2649
2650
2651
2652
2653
2654
2655
2635
2636
2637
2638
2639
2640
2641

2642
2643
2644
2645

2646
2647
2648
2649
2650
2651
2652
2653







-
+



-
+







        $top.m.help add command -label $label \
                -command [list makeDocWin $file] -underline 0
    }
    $top.m.help add separator
    $top.m.help add command -label "About" -command makeAboutWin -underline 0

    ttk::label $top.lr1 -text "Rev 1"
    addBalloon $top.lr1 "Revision number for CVS/RCS/ClearCase diff."
    addBalloon $top.lr1 "Revision number for version diff."
    ttk::entryX $top.er1 -width 12 -textvariable diff($top,doptrev1)
    set ::widgets($top,rev1) $top.er1
    ttk::label $top.lr2 -text "Rev 2"
    addBalloon $top.lr2 "Revision number for CVS/RCS/ClearCase diff."
    addBalloon $top.lr2 "Revision number for version diff."
    ttk::entryX $top.er2 -width 12 -textvariable diff($top,doptrev2)
    set ::widgets($top,rev2) $top.er2
    ttk::button $top.bcm -text Commit -command [list revCommit $top] \
            -state disabled -underline 0
    set ::widgets($top,commit) $top.bcm
    ttk::button $top.blg -text Log -command [list revLog $top] \
        -state disabled -underline 0