-
Notifications
You must be signed in to change notification settings - Fork 0
/
CODING__ListRCSonly.sh
131 lines (106 loc) · 4.22 KB
/
CODING__ListRCSonly.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
#23456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+
####################################################################################################
###
### $Id: CODING__ListRCSonly.sh,v 1.4 2020/09/26 20:22:21 root Exp $
###
### Script to identify files which only exist in RCS, and not extracted to directory in code PATH.
###
####################################################################################################
TMP=/tmp/`basename "$0" ".sh" `.tmp
Oasis=${Oasis:=/Oasis}
noMatch=""
showDetails=1
if [ "$1" = "--names" ] ; then showDetails=0 ; fi
#cd ${Oasis}/bin
here=`pwd`
for ftypes in ods odt txt sh
do
cd ${here}
rm -f ${TMP}.todo
( cd RCS ; ls *.${ftypes},v ) >${TMP}.todo 2>>/dev/null
#cat ${TMP}.todo >&2
if [ -s ${TMP}.todo ]
then
if [ ${showDetails} -eq 1 ] ; then echo "\n####################################################################################\n Examining *.${ftypes} not retrieved from RCS ...\n" >&2 ; fi
rm -f ${TMP}.nomatch
for file in `cat ${TMP}.todo `
do
#date 2018.07.29.02.55.10; author root; state Exp;
dateLin=`grep '^date' RCS/${file} | head -1 `
date=`echo "${dateLin}" | awk '{ print $2 }' | cut -f1 -d\; `
auth=`echo "${dateLin}" | awk '{ print $4 }' | cut -f1 -d\; `
stat=`echo "${dateLin}" | awk '{ print $6 }' | cut -f1 -d\; `
#grep '^#' RCS/${file} | grep '\$I' | grep 'd: ' | head -1 >&2
dat=`grep '^#' RCS/${file} | grep '\$I' | grep 'd: ' | head -1 |
awk -v matchS="Id: \$" -v fName="${file}" -v vdate="${date}" -v vauth="${auth}" -v vstat="${stat}" '{ n=index($0,matchS) ; if( n == 0 ){
print $0 ;
}else{
printf("\t %s [First Check-in] %s %s %s\n", fName, vdate, vauth, vstat ) ;
} ;
}' `
base=`basename "${file}" ",v" `
target="${here}/${base}"
if [ ! -s ${target} ]
then
rm -f ${target}
if [ ${showDetails} -eq 1 ]
then
echo "${dat}" | awk -v desc="NO_exec" '{ printf(" [%s,RCS] %s\n", desc, $0 ) ; }' >>${TMP}.nomatch
else
echo "${base}" >>${TMP}.nomatch
fi
fi
done #file
if [ -s ${TMP}.nomatch ] ; then cat ${TMP}.nomatch ; if [ ${showDetails} -eq 1 ] ; then echo "" ; fi ; fi
else
if [ ${showDetails} -eq 1 ] ; then echo "\n No files matching '*.${ftypes}' pattern in current directory.\n" >&2 ; fi
fi # ${TMP}.todo
done #ftype
#============================================================
#============================================================
#============================================================
rm -f ${TMP}.all
( cd RCS ; ls *,v ) >${TMP}.all 2>>/dev/null
rm -f ${TMP}.todo
cd ${here}
while read file
do
if [ ! -d "${file}" ]
then echo "${file}"
fi
done <${TMP}.all | grep -v '.ods,v$' | grep -v '.odt,v$' | grep -v '.txt,v$' | grep -v '.sh,v$' | awk '{ if ( NF >0 ){ print $0 } ; }' >${TMP}.todo
if [ -s ${TMP}.todo ]
then
if [ ${showDetails} -eq 1 ] ; then echo "\n####################################################################################\n Examining other file types not retrieved from RCS ...\n" >&2 ; fi
rm -f ${TMP}.nomatch
for file in `cat ${TMP}.todo `
do
dateLin=`grep '^date' RCS/${file} | head -1 `
date=`echo "${dateLin}" | awk '{ print $2 }' | cut -f1 -d\; `
auth=`echo "${dateLin}" | awk '{ print $4 }' | cut -f1 -d\; `
stat=`echo "${dateLin}" | awk '{ print $6 }' | cut -f1 -d\; `
dat=`grep '^#' RCS/${file} | grep '\$I' | grep 'd: ' | head -1 |
awk -v matchS="Id: \$" -v fName="${file}" -v vdate="${date}" -v vauth="${auth}" -v vstat="${stat}" '{ n=index($0,matchS) ; if( n == 0 ){
print $0 ;
}else{
printf("\t %s [First Check-in] %s %s %s\n", fName, vdate, vauth, vstat ) ;
} ;
}' `
base=`basename "${file}" ",v" `
target="${here}/${base}"
if [ ! -s ${target} ]
then
rm -f ${target}
if [ ${showDetails} -eq 1 ]
then
echo "${dat}" | awk -v desc="NO_exec" '{ printf(" [%s,RCS] %s\n", desc, $0 ) ; }' >>${TMP}.nomatch
else
echo "${base}" >>${TMP}.nomatch
fi
fi
done #file
if [ -s ${TMP}.nomatch ] ; then cat ${TMP}.nomatch ; if [ ${showDetails} -eq 1 ] ; then echo "" ; fi ; fi
else
if [ ${showDetails} -eq 1 ] ; then echo "\n No files of other than above types found in RCS.\n" >&2 ; fi
fi # ${TMP}.todo