home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
utility
/
misc
/
master
/
batch
/
merge.bat
< prev
next >
Wrap
DOS Batch File
|
1989-08-20
|
2KB
|
86 lines
# Merge two source directories. Ask user if we find differences, which version
# he wants to use. Eventually create a context-diff for some files.
if "$2" == "" {
rem Usage: $0 old-dir new-dir.
rem Not: $0 '$1' '$2'.
quit 1
}
VARSIZE 50000
rem Merging sources from $1 and $2
rem Phase 1 (removing identical entries - using comp)
if not exist phase_1.mrg {
files -50000 $2 => sources
foreach file in sources do
if exist $1/$file {
if not exec "comp -qs $1/$file $2/$file > NUL:" {
rm -q $1/$file
rem Erased $1/$file.
}
}
endfor
touch -q phase_1.mrg
}
rem Phase 2 (removing similar entries - using /bin/diff)
if not exist phase_2.mrg {
# files -50000 $2 => sources
# foreach file in sources do
# if exist $1/$file {
# if not exec "/bin/diff -b $1/$file $2/$file" {
# rm -q $1/$file
# rem Erased $1/$file.
# }
# }
# endfor
touch -q phase_2.mrg
}
rem Phase 3 (user interaction)
if not exist phase_3.mrg {
files -50000 $2 => sources
foreach file in sources do
if exist $1/$file {
/bin/diff -c $1/$file $2/$file|
get "Take \epN\eqew version, \epO\eqld version, \epS\eqkip or \epC\eqontext diff ? " answer
if answer == 'n' {
rm -q $1/$file
rem Erased $1/$file.
} else if answer == 'o' {
mv -qo $1/$file $2/$file
rem Substituted $2/$file with old version $1/$file.
} else if answer == 'c' {
if not exist $2/PATCHES {
touch -q $2/PATCHES
}
/bin/diff -c1 $1/$file $2/$file >> $2/PATCHES
} else {
rem Skipping $file.
}
# } else {
# rem Old file $1/$file is not found in new version.
# get "\epG\eqet it, \epE\eqrase or \epS\eqkip ? " answer
# if answer == 'g' {
# mv -q $1/$file $2/$file
# rem Added $1/$file as new file $2/$file.
# } else if answer == 'e' {
# rm -q $1/$file
# rem Erased $1/$file.
# } else {
# rem Skipping $1/$file.
# }
}
endfor
touch -q phase_3.mrg
}
rm -q phase_[1-3].mrg
rem Merging completed.
noVARSIZE