2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by scripts/Create-CopyPatch.
5 # T2 SDE: scripts/Commit
6 # Copyright (C) 2004 - 2020 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
26 [ ! -e "$1" -a -e `echo package/*/$1` ] &&
27 x
=`echo package/*/$1` || x
="$1"
28 locations
="$locations $x"
34 if [ -z "$locations" ]; then
35 echo "Usage $0 package/files"
39 trap 'echo "Got SIGINT (Ctrl-C)."; rm $$.log $$.diff; exit 1' INT
42 # CopyPatch and Checksum and CkSumPatch
44 svn st
$locations |
grep '^\(A\|M\)' | cut
-c8- |
while read f
; do
46 scripts
/Create-CopyPatch
$f |
patch -p0
47 if [[ $f = *.desc
]] && grep '\[D\] \+0 \+' $f; then
48 pkg
=${f%.desc} pkg
=${pkg##*/}
49 scripts
/Create-CkSumPatch
$pkg |
patch -p0
54 visualize_warnings
() {
55 # do not highlight just single space diff lines
57 s/\([[ \r\t]]*\)$/\o033[0;41m\1\o033[0m/
58 s/\( *\)/\o033[0;41m\1\o033[0m/
63 svn
diff $locations |
tee $$.
diff | visualize_warnings
65 # the grep -v === is a hack - somehow the svn === lines confuse awk ... ?!?
66 grep -v === $$.
diff |
awk "
69 /^\+\+\+ / { pkg = \$4 }
70 { if (sub(/^\+\[I\]/,\" -\") ) { info = \$0 } }
72 /^\-\[V\] / { oldver=\$2 }
76 print \"\t* updated \" pkg \" (\" oldver \" -> \" newver \")\"
78 print \"\t* added \" pkg \" (\" newver \")\" info
80 oldver=\"\"; newver=\"\"; info=\"\"
83 /^\-\[P\] / { oldprio=\$4 }
87 print \"\t* changed \" pkg \" build priority (\" oldprio \" -> \" newprio \")\"
88 oldprio=\"\"; newprior=\"\"
94 svn commit
$svnopt $locations --file $$.log
97 if [ -s $$.
diff ]; then
99 until [ $quit -ne 0 ]; do
102 if [ -s $$.log
]; then
106 echo -e "\tEmpty Log File!"
110 echo -en "\nLog ok (q=quit,e=edit,d=diff,s=status$commit)? "
111 [ ! "$force" ] && read in ||
in="commit"
114 c
*) if [ -n "$commit" ]; then
117 d
*) cat $$.
diff | visualize_warnings |
less -R ;;
118 s
*) svn st
$locations ;;
119 e
*) ${EDITOR:-vi} $$.log
;;
125 echo -e "\nNo changes detected at:$locations"