2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: scripts/Commit
4 # Copyright (C) 2004 - 2024 The T2 SDE Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
24 -u|
-untested) untested
=1 ;;
34 [ ! -e "$1" -a -e `echo package/*/$1` ] &&
35 x
=`echo package/*/$1` || x
="$1"
36 locations
="$locations $x"
42 if [ -z "$locations" ]; then
43 echo "Usage $0 package | files"
55 # save out [T], fold and insert with appropriate newlines
56 sed -n '/\[T\] \(.*\)/{s//\1/; H}; ${x; s/\n/ /g; s/^ //; p}' "$1" |
57 fold -w 76 -s |
sed 's/^/[T] /; s/ */ /g; s/ $//' > x
58 sed "/^\[I\].*/{ s//&\n/; r x
59 }; /^\[T\]/d" $1 |
sed '/^$/{n;/^$/d}' > x
.2
64 trap 'echo "Got SIGINT (Ctrl-C)."; exit 1' INT
66 # Copy .caches if requested
69 for p
in $locations; do
70 [[ $p != *package
/*/* ]] && continue
73 d
=$
(echo package
/*/$p)
74 cp -vf /var
/adm
/cache
/$p $d/$p.cache
78 # CopyPatch and Checksum and CkSumPatch
80 svn st
$locations |
grep '^\(A\|M\)' | cut
-c8- |
while read f
; do
82 scripts
/Create-CopyPatch
$f |
patch -p0
83 if [[ $f = *.desc
]]; then
84 [ "$fold" ] && fold_desc
$f
85 if grep '\[D\] \+0 \+' $f; then
86 pkg
=${f%.desc} pkg
=${pkg##*/}
87 scripts
/Create-CkSumPatch
$pkg |
patch -p0
93 visualize_warnings
() {
94 # do not highlight just single space diff lines
96 s/\([[ \r\t]]*\)$/\o033[0;41m\1\o033[0m/
97 s/\( *\)/\o033[0;41m\1\o033[0m/
102 svn
diff $locations |
tee $$.
diff | visualize_warnings
104 # the grep -v === is a hack - somehow the svn === lines confuse awk ... ?!?
105 grep -v === $$.
diff | gawk
"
106 BEGIN { FS=\"[ /]\" }
108 /^\+\+\+ / { pkg = \$4 }
109 { if (sub(/^\+\[I\]/,\" -\") ) { info = \$0 } }
111 /^\-\[V\] / { oldver=\$2 }
115 print \"\t* updated \" pkg \" (\" oldver \" -> \" newver \")\"
117 print \"\t* added \" pkg \" (\" newver \")\" info
119 oldver=\"\"; newver=\"\"; info=\"\"
122 /^\-\[P\] / { oldprio=\$4 }
126 print \"\t* changed \" pkg \" build priority (\" oldprio \" -> \" newprio \")\"
127 oldprio=\"\"; newprior=\"\"
132 [ "$untested" ] && sed -i -z 's/\n$/, untested\n/g' $$.log
134 [ "$addtxt" ] && sed -i "\$s|\$|$addtxt|" $$.log
137 svn commit
$svnopt $locations --file $$.log ||
exit $?
140 if [ -s $$.
diff ]; then
142 until [ $quit -ne 0 ]; do
145 if [ -s $$.log
]; then
149 echo -e "\tEmpty Log File!"
153 echo -en "\nLog ok (q=quit,e=edit,d=diff,s=status$commit)? "
154 [ ! "$force" ] && read in ||
in="commit"
157 c
*) if [ -n "$commit" ]; then
160 d
*) cat $$.
diff | visualize_warnings |
less -R ;;
161 s
*) svn st
$locations ;;
162 e
*) ${EDITOR:-vi} $$.log
;;
168 echo -e "\nNo changes detected at:$locations"