script:svn_patch: improve help and use revision

This commit is contained in:
Mathieu Maret 2017-04-27 09:57:40 +02:00
parent e33c46249d
commit 7bfce9ab40
1 changed files with 16 additions and 4 deletions

View File

@ -5,7 +5,14 @@ IFS=$'\n\t'
addHeader=false
function usage {
echo -e "Usage: $(basename $0) [NB_COMMIT]"
echo -e "Usage: $(basename $0) [OPTIONS] COMMIT"
echo -e " Generate patch from COMMIT."
echo -e " COMMIT is either:"
echo -e " * a number of commit"
echo -e " * a revision starting with r"
echo -e ""
echo -e "Available options:"
echo -e " -h: add commit msg to the beginning of the patches"
}
while getopts ":h" opt; do
@ -26,10 +33,15 @@ if [ $# != 1 ]; then
usage
exit 1
fi
revision=0
if [[ $1 == r* ]];then
revisions=$(svn log -rHEAD:${1#r} | grep -e "^r[0-9]" | cut -f1 -d" " | cut -c2-)
else
nb_rev=$1
nb_rev=$((nb_rev+1))
revisions=$(svn log -l $nb_rev | grep -e "^r[0-9]" | cut -f1 -d" " | cut -c2-)
fi
nb_rev=$1
nb_rev=$((nb_rev+1))
revisions=$(svn log -l $nb_rev | grep -e "^r[0-9]" | cut -f1 -d" " | cut -c2-)
i=0
prev=0
first=0