From 7bfce9ab40d2f6efa0702ccd00471e74c76ae234 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 27 Apr 2017 09:57:40 +0200 Subject: [PATCH] script:svn_patch: improve help and use revision --- scripts/svn_patch | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/svn_patch b/scripts/svn_patch index a08bb60..868fbed 100755 --- a/scripts/svn_patch +++ b/scripts/svn_patch @@ -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