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 ---
23 -u|
-untested) untested
=1 ;;
31 [ ! -e "$1" -a -e `echo package/*/$1` ] &&
32 x
=`echo package/*/$1` || x
="$1"
33 locations
="$locations $x"
39 if [ -z "$locations" ]; then
40 echo "Usage $0 package | files"
51 trap 'echo "Got SIGINT (Ctrl-C)."; exit 1' INT
53 # Copy .caches if requested
56 for p
in $locations; do
57 [[ $p != *package
/*/* ]] && continue
60 d
=$
(echo package
/*/$p)
61 cp -vf /var
/adm
/cache
/$p $d/$p.cache
65 # CopyPatch and Checksum and CkSumPatch
67 svn st
$locations |
grep '^\(A\|M\)' | cut
-c8- |
while read f
; do
69 scripts
/Create-CopyPatch
$f |
patch -p0
70 if [[ $f = *.desc
]] && grep '\[D\] \+0 \+' $f; then
71 pkg
=${f%.desc} pkg
=${pkg##*/}
72 scripts
/Create-CkSumPatch
$pkg |
patch -p0
77 visualize_warnings
() {
78 # do not highlight just single space diff lines
80 s/\([[ \r\t]]*\)$/\o033[0;41m\1\o033[0m/
81 s/\( *\)/\o033[0;41m\1\o033[0m/
86 svn
diff $locations |
tee $$.
diff | visualize_warnings
88 # the grep -v === is a hack - somehow the svn === lines confuse awk ... ?!?
89 grep -v === $$.
diff | gawk
"
92 /^\+\+\+ / { pkg = \$4 }
93 { if (sub(/^\+\[I\]/,\" -\") ) { info = \$0 } }
95 /^\-\[V\] / { oldver=\$2 }
99 print \"\t* updated \" pkg \" (\" oldver \" -> \" newver \")\"
101 print \"\t* added \" pkg \" (\" newver \")\" info
103 oldver=\"\"; newver=\"\"; info=\"\"
106 /^\-\[P\] / { oldprio=\$4 }
110 print \"\t* changed \" pkg \" build priority (\" oldprio \" -> \" newprio \")\"
111 oldprio=\"\"; newprior=\"\"
116 [ "$untested" ] && sed -i -z 's/\n$/, untested\n/g' $$.log
118 [ "$addtxt" ] && sed -i "\$s|\$|$addtxt|" $$.log
121 svn commit
$svnopt $locations --file $$.log ||
exit $?
124 if [ -s $$.
diff ]; then
126 until [ $quit -ne 0 ]; do
129 if [ -s $$.log
]; then
133 echo -e "\tEmpty Log File!"
137 echo -en "\nLog ok (q=quit,e=edit,d=diff,s=status$commit)? "
138 [ ! "$force" ] && read in ||
in="commit"
141 c
*) if [ -n "$commit" ]; then
144 d
*) cat $$.
diff | visualize_warnings |
less -R ;;
145 s
*) svn st
$locations ;;
146 e
*) ${EDITOR:-vi} $$.log
;;
152 echo -e "\nNo changes detected at:$locations"