受不了每次 svn commit 都要做很多步驟,
故把幾個步驟濃縮成 shell script,
記錄一下.
原本行為:
1. 改完 code, svn status, 觀察這次做了哪些修改.
2. svn commit -m "blah blah blah" xxx.c xxx.h ...
缺點:
1. commit message 擠成一行, 沒格式, 不好閱讀.
2. xxx.c xxx.h ... 要自己手動複製貼上, 麻煩 ...
修改行為:
1. 改完 code, sh status.sh
status.sh:
svn status | grep "M" | grep -v ".bak" | awk '{print $2}' > svn_status
echo >> svn_status
2. 把 commit message 記錄在 svn_commit_msg
3. sh commit.sh
commit.sh:
while read line
do
name+=" "$line
done < svn_status
svn commit -F svn_commit_msg $name
還有很大的補強空間, 不過先這樣吧.
目前堪用就好.
Ref:
http://stackoverflow.com/questions/2250131/how-do-you-append-to-an-already-existing-string
http://stackoverflow.com/questions/4181703/how-can-i-concatenate-string-variables-in-bash
http://stackoverflow.com/questions/10929453/bash-scripting-read-file-line-by-line
留言列表