diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2008-12-15 18:09:22 +0000 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2008-12-15 18:09:22 +0000 |
commit | 59090df851f0d50231ad90ba9b3cd79d4b88f072 (patch) | |
tree | 8ae8e95ac6e87f53d3feb0ee6b0c16a56ee9abfe /scripts/patch-renumber.sh | |
parent | 4cfd308098db9eccc48a2cb47c769ec4bcc65d9d (diff) | |
download | crosstool-ng-59090df851f0d50231ad90ba9b3cd79d4b88f072.tar.gz crosstool-ng-59090df851f0d50231ad90ba9b3cd79d4b88f072.tar.bz2 crosstool-ng-59090df851f0d50231ad90ba9b3cd79d4b88f072.zip |
Move patch-renumber.sh from tools/ to scripts/
Diffstat (limited to 'scripts/patch-renumber.sh')
-rwxr-xr-x | scripts/patch-renumber.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/patch-renumber.sh b/scripts/patch-renumber.sh new file mode 100755 index 00000000..f46c064d --- /dev/null +++ b/scripts/patch-renumber.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Yes, this intends to be a true POSIX script file. + +myname="$0" + +doUsage() { + cat <<_EOF_ +Usage: ${myname} <dir> <base> <inc> + Will renumber all patches found in <dir>, starting at <base>, and with + an increment of <inc> + Eg.: patch-renumber patches/gcc/4.3.1 100 10 +_EOF_ +} + +[ $# -eq 3 ] || { doUsage; exit 1; } +[ -d "${1}" ] || { doUsage; exit 1; } + +dir="${1}" +cpt="${2}" +inc="${3}" + +case $(LC_ALL=C svnversion 2>/dev/null) in + exported) CMD="mv -v";; + *) CMD="svn mv";; +esac + +for p in "${dir}"/*.patch; do + [ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; } + newname="$(printf "%03d" ${cpt})-$(basename "${p}" |sed -r -e 's/^[[:digit:]]{3}-//')" + [ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}" + cpt=$((cpt+inc)) +done |