︙ | | | ︙ | |
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
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
set ch [open $::diff($top,patchFile) r]
set style ""
set divider "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
set leftLine 1
set rightLine 1
set leftLines {}
|
>
>
>
|
>
|
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
|
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
} else {
set ch [open $::diff($top,patchFile) r]
}
set style ""
set divider "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
set leftLine 1
set rightLine 1
set leftLines {}
|
︙ | | | ︙ | |
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
|
continue
}
}
if {$state != "none"} {
displayOnePatch $top $leftLines $rightLines $leftLine $rightLine
}
close $ch
}
#####################################
# Main diff
#####################################
# Prepare for a diff by creating needed temporary files
|
>
|
>
|
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
|
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
|
︙ | | | ︙ | |
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
|
proc FileIsDirectory {file {kitcheck 0}} {
# Skip directories
if {[file isdirectory $file]} {return 1}
# This detects .kit but how to detect starpacks?
if {[file extension $file] eq ".kit" | $kitcheck} {
if {![catch {package require vfs::mk4}]} {
vfs::mk4::Mount $file $file -readonly
# Check for contents to ensure it is a kit
if {[llength [glob -nocomplain $file/*]] == 0} {
vfs::unmount $file
}
}
}
return [file isdirectory $file]
}
# A wrapper for tk_getOpenFile
|
|
|
|
|
>
|
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
|
proc FileIsDirectory {file {kitcheck 0}} {
# Skip directories
if {[file isdirectory $file]} {return 1}
# This detects .kit but how to detect starpacks?
if {[file extension $file] eq ".kit" | $kitcheck} {
if {![catch {package require vfs::mk4}]} {
if {![catch {vfs::mk4::Mount $file $file -readonly}]} {
# Check for contents to ensure it is a kit
if {[llength [glob -nocomplain $file/*]] == 0} {
vfs::unmount $file
}
}
}
}
return [file isdirectory $file]
}
# A wrapper for tk_getOpenFile
|
︙ | | | ︙ | |
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
|
-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.
-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.
|
>
|
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
|
-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.
-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.
|
︙ | | | ︙ | |
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
|
}
} elseif {$arg eq "-o"} {
set nextArg mergeFile
} elseif {$arg eq "-r"} {
set nextArg revision
} elseif {$arg eq "-debug"} {
set ::debug 1
} else {
set apa [file normalize [file join [pwd] $arg]]
if {![file exists $apa]} {
puts "Bad argument: $arg"
exit
} else {
lappend files $apa
|
>
>
>
|
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
|
}
} elseif {$arg eq "-o"} {
set nextArg mergeFile
} elseif {$arg eq "-r"} {
set nextArg revision
} elseif {$arg eq "-debug"} {
set ::debug 1
} elseif {$arg eq "-"} {
# Allow "-" for stdin patch processing
lappend files "-"
} else {
set apa [file normalize [file join [pwd] $arg]]
if {![file exists $apa]} {
puts "Bad argument: $arg"
exit
} else {
lappend files $apa
|
︙ | | | ︙ | |
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
|
if {$len == 0 && $dodir} {
set dirdiff(leftDir) [pwd]
set dirdiff(rightDir) [pwd]
makeDirDiffWin
return
}
if {$len == 1} {
set fullname [file join [pwd] [lindex $files 0]]
if {[FileIsDirectory $fullname 1]} {
set dirdiff(leftDir) $fullname
set dirdiff(rightDir) $dirdiff(leftDir)
makeDirDiffWin
return
}
} elseif {$len >= 2} {
set fullname1 [file join [pwd] [lindex $files 0]]
set fullname2 [file join [pwd] [lindex $files 1]]
if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
set dirdiff(leftDir) $fullname1
set dirdiff(rightDir) $fullname2
makeDirDiffWin
after idle doDirCompare
return
}
|
|
|
|
|
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
|
if {$len == 0 && $dodir} {
set dirdiff(leftDir) [pwd]
set dirdiff(rightDir) [pwd]
makeDirDiffWin
return
}
if {$len == 1} {
set fullname [lindex $files 0]
if {[FileIsDirectory $fullname 1]} {
set dirdiff(leftDir) $fullname
set dirdiff(rightDir) $dirdiff(leftDir)
makeDirDiffWin
return
}
} elseif {$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
makeDirDiffWin
after idle doDirCompare
return
}
|
︙ | | | ︙ | |
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
|
foreach {item val} [array get opts] {
set ::diff($top,$item) $val
}
# It is preferable to see the end if the rev string is too long
$::widgets($top,rev1) xview end
$::widgets($top,rev2) xview end
}
set fullname [file join [pwd] $file]
set fulldir [file dirname $fullname]
if {$::diff($top,mode) eq "conflict"} {
startConflictDiff $top $fullname
after idle [list doDiff $top]
set ReturnAfterLoop 1
continue
}
|
|
|
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
|
foreach {item val} [array get opts] {
set ::diff($top,$item) $val
}
# It is preferable to see the end if the rev string is too long
$::widgets($top,rev1) xview end
$::widgets($top,rev2) xview end
}
set fullname $file
set fulldir [file dirname $fullname]
if {$::diff($top,mode) eq "conflict"} {
startConflictDiff $top $fullname
after idle [list doDiff $top]
set ReturnAfterLoop 1
continue
}
|
︙ | | | ︙ | |
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
|
}
}
# No revision control. Is it a patch file?
set ::diff($top,leftDir) $fulldir
set ::diff($top,leftFile) $fullname
set ::diff($top,leftLabel) $fullname
set ::diff($top,leftOK) 1
if {$dopatch || [regexp {\.(diff|patch)$} $fullname]} {
set ::diff($top,mode) "patch"
set ::diff($top,patchFile) $fullname
set autobrowse 0
if {$noautodiff} {
enableRedo $top
} else {
after idle [list doDiff $top]
|
>
|
>
|
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
|
}
}
# No revision control. Is it a patch file?
set ::diff($top,leftDir) $fulldir
set ::diff($top,leftFile) $fullname
set ::diff($top,leftLabel) $fullname
set ::diff($top,leftOK) 1
if {$dopatch || \
[regexp {\.(diff|patch)$} $fullname] || \
$fullname eq "-"} {
set ::diff($top,mode) "patch"
set ::diff($top,patchFile) $fullname
set autobrowse 0
if {$noautodiff} {
enableRedo $top
} else {
after idle [list doDiff $top]
|
︙ | | | ︙ | |