summaryrefslogtreecommitdiff
path: root/maint/bump_nodep
blob: afe969d86890712b98c9a911f7ae10484cf7ba30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
#
# 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 proceeding." >&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" checkout .
done

"$GIT" status