Fix patch-renumber:

- look at the patch directory when using svnversion, not at current directory
- some code beautification.

 /trunk/scripts/patch-renumber.sh |    9     7     2     0 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
This commit is contained in:
Yann E. MORIN" 2009-02-01 23:15:59 +00:00
parent 97b23feb3a
commit 7fc16eff80

View File

@ -23,14 +23,19 @@ dir="${1}"
cpt="${2}"
inc="${3}"
case $(LC_ALL=C svnversion 2>/dev/null) in
case "$(LC_ALL=C svnversion "${dir}" 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}-//')"
newname="$(printf "%03d-%s" \
"${cpt}" \
"$(basename "${p}" \
|"${sed}" -r -e 's/^[[:digit:]]+[-_]//' \
)" \
)"
[ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}"
cpt=$((cpt+inc))
done