2 # Yes, this intends to be a true POSIX script file.
7 # Parse the tools' paths configuration
12 Usage: ${myname} <dir> <base> <inc>
13 Will renumber all patches found in <dir>, starting at <base>, and with
15 Eg.: patch-renumber patches/gcc/4.3.1 100 10
19 [ $# -eq 3 ] || { doUsage; exit 1; }
20 [ -d "${1}" ] || { doUsage; exit 1; }
26 case "$(LC_ALL=C svnversion "${dir}" 2>/dev/null)" in
27 exported) CMD="mv -v";;
31 for p in "${dir}"/*.patch; do
32 [ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; }
33 newname="$(printf "%03d-%s" \
36 |"${sed}" -r -e 's/^[[:digit:]]+[-_]//' \
39 [ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}"