︙ | | |
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
920
921
922
|
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
920
921
922
923
924
925
926
|
-
-
+
+
+
+
+
+
-
+
|
proc displayPatch {top} {
global Pref
set ::diff($top,leftLabel) "Patch $::diff($top,patchFile): old"
set ::diff($top,rightLabel) "Patch $::diff($top,patchFile): new"
update idletasks
if {$::diff($top,patchFile) eq "-"} {
set ch stdin
if {$::diff($top,patchFile) eq ""} {
set data [getFullPatch $top]
} elseif {$::diff($top,patchFile) eq "-"} {
set data [read stdin]
} else {
set ch [open $::diff($top,patchFile) r]
set data [read $ch]
close $ch
}
set style ""
set divider "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
set leftLine 1
set rightLine 1
set leftLines {}
set rightLines {}
set state none
while {[gets $ch line] != -1} {
foreach line [split $data \n] {
if {[string match ======* $line]} {
if {$state != "none"} {
displayOnePatch $top $leftLines $rightLines $leftLine $rightLine
}
set leftLines {}
set rightLines {}
set state none
|
︙ | | |
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
|
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
|
-
-
-
-
|
}
continue
}
}
if {$state != "none"} {
displayOnePatch $top $leftLines $rightLines $leftLine $rightLine
}
if {$ch ne "stdin"} {
close $ch
}
}
#####################################
# Main diff
#####################################
# Prepare for a diff by creating needed temporary files
|
︙ | | |
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
|
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
|
+
|
-nodiff : Normally, if there are enough information on the
command line to run diff, Eskil will do so unless
this option is specified.
-dir : Start in directory diff mode. Ignores other args.
-clip : Start in clip diff mode. Ignores other args.
-patch : View patch file.
- : Read patch file from standard input, to allow pipes.
-review : View revision control tree as a patch.
-context <n>: Show only differences, with <n> lines of context.
-foreach : Open one diff window per file listed.
-close : Close windows with no changes.
-noparse : Eskil can perform analysis of changed blocks to
-line : improve display. See online help for details.
-smallblock : The default. Do block analysis on small blocks.
|
︙ | | |
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
|
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
|
-
+
|
return
}
set allOpts {
-w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix
-noparse -line -smallblock -block -char -word -limit -nodiff -dir
-clip -patch -browse -conflict -print -printps -printpdf
-server -o -r -context -cvs -svn
-server -o -r -context -cvs -svn -review
-foreach -preprocess -close -nonewline
}
# If the first option is "--query", use it to ask about options.
if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {
set arg [lindex $::eskil(argv) 1]
if {[lsearch -exact $allOpts $arg] < 0} {
|
︙ | | |
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
|
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
|
+
|
set autobrowse 0
set dodir 0
set doclip 0
set files ""
set nextArg ""
set revNo 1
set dopatch 0
set doreview 0
set foreach 0
set preferedRev "GIT"
foreach arg $::eskil(argv) {
if {$nextArg != ""} {
if {$nextArg eq "mergeFile"} {
set opts(mergeFile) [file join [pwd] $arg]
|
︙ | | |
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
|
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
|
+
-
+
|
}
}
}
set nextArg ""
continue
}
# Take care of the special case of RCS style -r<rev>
if {$arg ne "-review" && [string range $arg 0 1] eq "-r" && \
if {[string range $arg 0 1] eq "-r" && [string length $arg] > 2} {
[string length $arg] > 2} {
set opts(doptrev$revNo) [string range $arg 2 end]
incr revNo
continue
}
# Try to see if it is an unique abbreviation of an option.
# If not, let it fall through to the file check.
if {[lsearch -exact $allOpts $arg] < 0} {
|
︙ | | |
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
|
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
|
+
+
|
set noautodiff 1
} elseif {$arg eq "-dir"} {
set dodir 1
} elseif {$arg eq "-clip"} {
set doclip 1
} elseif {$arg eq "-patch"} {
set dopatch 1
} elseif {$arg eq "-review"} {
set doreview 1
} elseif {$arg eq "-browse"} {
set autobrowse 1
} elseif {$arg eq "-foreach"} {
set foreach 1
} elseif {$arg eq "-nonewline"} {
set ::eskil(ignorenewline) 1
} elseif {$arg eq "-nonewline+"} {
|
︙ | | |
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
|
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
|
+
+
+
+
+
+
+
+
|
set ::diff($top,rightLabel) $fullname
set ::diff($top,rightOK) 1
if {$noautodiff} {
enableRedo $top
} else {
after idle [list doDiff $top]
}
}
if {$doreview} {
set rev [detectRevSystem "" $preferedRev]
set ::diff($top,modetype) $rev
set ::diff($top,mode) "patch"
set ::diff($top,patchFile) ""
after idle [list doDiff $top]
return
}
if {$autobrowse && (!$::diff($top,leftOK) || !$::diff($top,rightOK))} {
if {!$::diff($top,leftOK) && !$::diff($top,rightOK)} {
openBoth $top 0
} elseif {!$::diff($top,leftOK)} {
openLeft $top
} elseif {!$::diff($top,rightOK)} {
|
︙ | | |