2023-08-09 13:33:01 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-08-01 17:57:58 +01:00
|
|
|
#
|
|
|
|
# Increment the version of one or more crates, without incrementing
|
|
|
|
# the versions of their dependencies.
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
|
|
echo "I expect a list of crates whose versions should get bumped." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! git diff-index --quiet HEAD -- ; then
|
|
|
|
echo "Git checkout is modified; not proceding." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
: "${GIT:=git}"
|
|
|
|
: "${CARGO:=cargo}"
|
|
|
|
|
|
|
|
for cratename in "$@"; do
|
|
|
|
C=crates/"$cratename"/Cargo.toml
|
|
|
|
if [ ! -f "$C" ]; then
|
|
|
|
echo "Did not find $C; exiting." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for cratename in "$@"; do
|
|
|
|
C=crates/"$cratename"/Cargo.toml
|
|
|
|
"$CARGO" set-version --bump patch -p "$cratename"
|
|
|
|
echo "Staging $C"
|
|
|
|
"$GIT" add "$C"
|
|
|
|
echo "Discarding other changes."
|
|
|
|
"$GIT" restore .
|
|
|
|
done
|
|
|
|
|
|
|
|
"$GIT" status
|
|
|
|
|