Eskil

Diff
Login

Differences From Artifact [87546644c9]:

To Artifact [b8c85357ce]:


16
17
18
19
20
21
22
23
24
25



26
27
28
29
30




31
32
33


34
35
36






37
38
39
40
41
42
43
16
17
18
19
20
21
22



23
24
25
26




27
28
29
30
31


32
33
34


35
36
37
38
39
40
41
42
43
44
45
46
47







-
-
-
+
+
+

-
-
-
-
+
+
+
+

-
-
+
+

-
-
+
+
+
+
+
+







#                                    from within.
#                                    If only one file is given, the program
#                                    looks for an RCS directory next to the
#                                    file, and if found, runs in RCS mode.
#
#             Options for diff.tcl:
#
#             -nodiff  : Normally, if there are enough information on the
#                        command line to run diff, diff.tcl will do so unless
#                        this option is specified.
#             -nodiff   : Normally, if there are enough information on the
#                         command line to run diff, diff.tcl will do so unless
#                         this option is specified.
#
#             -noparse : Diff.tcl can perform analysis of changed blocks to
#             -line    : improve display. See online help for details.
#             -block   : The default is -block, but this can be slow if there
#                        are large change blocks.
#             -noparse  : Diff.tcl can perform analysis of changed blocks to
#             -line     : improve display. See online help for details.
#             -block    : The default is -block, but this can be slow if there
#                         are large change blocks.
#
#             -char    : The analysis of changes can be done on either
#             -word    : character or word basis. -char is the default.
#             -char     : The analysis of changes can be done on either
#             -word     : character or word basis. -char is the default.
#
#             -2nd     : Turn on or off second stage parsing.
#             -no2nd   : It is on by default.
#             -2nd      : Turn on or off second stage parsing.
#             -no2nd    : It is on by default.
#          
#             -conflict : Treat file as a merge conflict file and enter merge
#                         mode.
#             -o <file> : Specify merge result output file. 
#
#   Author    Peter Spjuth  980612
#
#   Revised   By       Date     Remark
#
#     1.0     DC-PS    980612   New Version.
#     1.1     DC-PS    980807   Parsing of change blocks added
60
61
62
63
64
65
66


67
68
69
70
71
72
73


74
75
76
77
78
79
80
64
65
66
67
68
69
70
71
72
73
74
75
76
77


78
79
80
81
82
83
84
85
86







+
+





-
-
+
+







#                               Added "Mark last" option
#     1.6     DA-PS    000131   Added scroll-keys
#                               Bug-fixes in scroll map and printing
#     1.7     DA-PS    000427   Restricted parsing of large blocks.
#                               Fixed bug with spaces in file names.
#                               Regular screen updates during processing.
#                               Added CVS support.
#     1.8     DA-PS    001115   Highlight current diff.
#                               New -conflict flag to handle merge conflicts.
#
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 1
set diffver "Version 1.8b  001103"
set debug 0
set diffver "Version 1.8  001115"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]

if {$tcl_platform(platform) == "windows"} {
    cd $thisdir
829
830
831
832
833
834
835
836

837
838
839
840

841
842
843
844
845
846
847
835
836
837
838
839
840
841

842
843
844
845

846
847
848
849
850
851
852
853







-
+



-
+







    set rightLine 1
    set state both
    while {[gets $ch line] != -1} {
        if {[string match <<<<<<* $line]} {
            set state right
            regexp {<*\s*(.*)} $line -> rightName
            set start2 $rightLine
        } elseif {[string match ======* $line]} {
        } elseif {[string match ======* $line] && $state == "right"} {
            set state left
            set end2 [expr {$rightLine - 1}]
            set start1 $leftLine
        } elseif {[string match >>>>>>* $line]} {
        } elseif {[string match >>>>>>* $line] && $state == "left"} {
            set state both
            regexp {>*\s*(.*)} $line -> leftName
            set end1 [expr {$leftLine - 1}]
            lappend diff(conflictDiff) $start1,${end1}c$start2,$end2
        } elseif {$state == "both"} {
            puts $ch1 $line
            puts $ch2 $line
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1418
1419
1420
1421
1422
1423
1424



1425
1426
1427
1428
1429
1430
1431







-
-
-







    while {[gets $ch2 apa] != -1} {
        append data2 $apa\n
        incr doingLine2
    }
    lappend leftMergeData $data1
    lappend rightMergeData $data2

    puts [list Left: $leftMergeData]
    puts [list Right: $rightMergeData]

    close $ch1
    close $ch2

    if {$diff(mode) == "RCS" || $diff(mode) == "CVS"} {
        cleanupRCS
    } elseif {[string match "conflict*" $diff(mode)]} {
        cleanupConflict
2320
2321
2322
2323
2324
2325
2326
2327

2328
2329
2330
2331
2332
2333
2334
2323
2324
2325
2326
2327
2328
2329

2330
2331
2332
2333
2334
2335
2336
2337







-
+








proc makeAboutWin {} {
    global diffver
    destroy .ab

    toplevel .ab
    wm title .ab "About Diff.tcl"
    text .ab.t -width 40 -height 11 -wrap word
    text .ab.t -width 45 -height 11 -wrap word
    button .ab.b -text "Close" -command "destroy .ab"
    pack .ab.b -side bottom
    pack .ab.t -side top -expand y -fill both

    .ab.t insert end "A Tcl/Tk frontend to diff\n\n"
    .ab.t insert end "$diffver\n"
    .ab.t insert end "Made by Peter Spjuth\n"
2406
2407
2408
2409
2410
2411
2412













2413
2414
2415
2416
2417
2418
2419
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435







+
+
+
+
+
+
+
+
+
+
+
+
+







Prev Diff Button: Scrolls to the previous differing block, or to the top
                  if there are no more diffs.
Next Diff Button: Scrolls to the next differing block, or to the bottom
                  if there are no more diffs.

Equal sign: Above the vertical scrollbar, a "=" will appear if the files
            are equal.

} "" {Merge Window (Appears in conflict mode)} ul {

You can, for each difference, select which version you want to appear
in the output file. The buttons "LR", "L", "R" and "RL" select the
lines from the left file, right file or both files.
"Prev" and "Next" buttons moves between differences.
"All L" and "All R" buttons select "L" or "R" for all differences.
"Pure" ...
"Save" saves the merge result to a file.

On the keyboard, Up and Down keys means the same as "Prev" and "Next".
Left and Right keys selects "L" and "R".

} "" {Examples of effects of parse options.} ul {

Below are two example files, and five different results when using
different options with those files.

Left file:                       Right file: