source: projects/ckbs/trunk/commit.sh

Last change on this file was 1096, checked in by aleksand, 7 years ago

updated files

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#! /bin/bash -e
2#
3# replacement text for this commit
4cat << EOF > commit.$$
5
6Removed srcIP, and added covariance estimation routine and test.
7EOF
8# -----------------------------------------------------------------------
9if [ "$1" == 'files' ]
10then
11        echo "rm commit.[0-9]*"
12        rm commit.[0-9]*
13        #
14        echo "cp commit.sh commit.old"
15        cp commit.sh commit.old
16        #
17        echo "svn revert commit.sh"
18        svn revert commit.sh
19        #
20        sed -n -e '1,/^$/p' < commit.sh > commit.$$ 
21        svn status | sed -n -e '/^[ADMRC] /p' | \
22                sed -e 's/^[ADMR] [+ ]*//' -e 's/$/@/' | \
23                sort -u >> commit.$$
24        sed -n -e '/^EOF/,$p' < commit.sh >> commit.$$ 
25        #
26        echo "diff commit.sh commit.$$"
27        if diff commit.sh commit.$$
28        then
29                echo "commit.sh: exiting because commit.sh has not changed"
30                exit 1
31        fi
32        #
33        echo "mv commit.$$ commit.sh"
34        mv commit.$$ commit.sh
35        #
36        chmod +x commit.sh
37        exit 0
38fi
39# -----------------------------------------------------------------------
40if [ "$1" != 'run' ]
41then
42cat << EOF
43usage: ./commit.sh files
44       ./commit.sh run
45
46example/tridiag_solve_ok.m@
47src/ckbs_tridiag_solve.m@
48src/ckbs_tridiag_solve_b.m@
49src/ckbs_tridiag_solve_mf.m@
50EOF
51# -----------------------------------------------------------------------
52if [ "$1" == 'files' ]
53then
54        echo "rm commit.[0-9]*"
55        rm commit.[0-9]*
56        #
57        echo "cp commit.sh commit.old"
58        cp commit.sh commit.old
59        #
60        echo "svn revert commit.sh"
61        svn revert commit.sh
62        #
63        sed -n -e '1,/^$/p' < commit.sh > commit.$$ 
64        svn status | sed -n -e '/^[ADMRC] /p' | \
65                sed -e 's/^[ADMR] [+ ]*//' -e 's/$/@/' | \
66                sort -u >> commit.$$
67        sed -n -e '/^EOF/,$p' < commit.sh >> commit.$$ 
68        #
69        echo "diff commit.sh commit.$$"
70        if diff commit.sh commit.$$
71        then
72                echo "commit.sh: exiting because commit.sh has not changed"
73                exit 1
74        fi
75        #
76        echo "mv commit.$$ commit.sh"
77        mv commit.$$ commit.sh
78        #
79        chmod +x commit.sh
80        exit 0
81fi
82# -----------------------------------------------------------------------
83if [ "$1" != 'run' ]
84then
85cat << EOF
86usage: ./commit.sh files
87       ./commit.sh run
88
89example/tridiag_inv_ok.m@
90src/ckbs_tridiag_inv.m@
91EOF
92# -----------------------------------------------------------------------
93if [ "$1" == 'files' ]
94then
95        echo "rm commit.[0-9]*"
96        rm commit.[0-9]*
97        #
98        echo "cp commit.sh commit.old"
99        cp commit.sh commit.old
100        #
101        echo "svn revert commit.sh"
102        svn revert commit.sh
103        #
104        sed -n -e '1,/^$/p' < commit.sh > commit.$$ 
105        svn status | sed -n -e '/^[ADMRC] /p' | \
106                sed -e 's/^[ADMR] [+ ]*//' -e 's/$/@/' | \
107                sort -u >> commit.$$
108        sed -n -e '/^EOF/,$p' < commit.sh >> commit.$$ 
109        #
110        echo "diff commit.sh commit.$$"
111        if diff commit.sh commit.$$
112        then
113                echo "commit.sh: exiting because commit.sh has not changed"
114                exit 1
115        fi
116        #
117        echo "mv commit.$$ commit.sh"
118        mv commit.$$ commit.sh
119        #
120        chmod +x commit.sh
121        exit 0
122fi
123# -----------------------------------------------------------------------
124if [ "$1" != 'run' ]
125then
126cat << EOF
127usage: ./commit.sh files
128       ./commit.sh run
129
130The first from changes the list of files at the beginning of commit.sh
131so that it all the files that have changed status.
132You should then edit commit.sh by hand (as per the instrucgtion at the
133beginning of commit.sh) before running the second form.
134
135The second form actually commits the list of files (provided that you reply
136y to the [y/n] prompt that commit.sh generates).
137EOF
138        rm commit.$$
139        exit 0
140fi
141# -----------------------------------------------------------------------
142list=`sed -e '/@/! d' -e 's/@.*//' commit.$$`
143msg=`sed -e '/@ *$/d' -e 's|.*/\([^/]*@\)|\1|' -e 's|@|:|' commit.$$`
144rm commit.$$
145echo "svn commit -m \""
146echo "$msg"
147echo "\" \\"
148echo "$list"
149read -p "is this ok [y/n] ?" response
150if [ "$response" != "y" ]
151then
152        exit 1
153fi
154#
155if ! svn commit -m "$msg" $list
156then
157        echo "commit.sh: commit failed"
158        exit 1
159fi
160#
161echo "mv commit.sh commit.old"
162mv commit.sh commit.old
163#
164svn revert commit.sh
Note: See TracBrowser for help on using the repository browser.