/ maint / bump_nodep
bump_nodep
 1  #!/usr/bin/env bash
 2  #
 3  # Increment the version of one or more crates, without incrementing
 4  # the versions of their dependencies.
 5  
 6  set -euo pipefail
 7  
 8  if [ "$#" -eq 0 ]; then
 9      echo "I expect a list of crates whose versions should get bumped." >&2
10      exit 1
11  fi
12  
13  if ! git diff-index --quiet HEAD -- ; then
14      echo "Git checkout is modified; not proceeding." >&2
15      exit 1
16  fi
17  
18  : "${GIT:=git}"
19  : "${CARGO:=cargo}"
20  
21  for cratename in "$@"; do
22      C=crates/"$cratename"/Cargo.toml
23      if [ ! -f "$C" ]; then
24         echo "Did not find $C; exiting." >&2
25         exit 1
26      fi
27  done
28  
29  for cratename in "$@"; do
30      C=crates/"$cratename"/Cargo.toml
31      $CARGO set-version --bump patch -p "$cratename"
32      echo "Staging $C"
33      "$GIT" add "$C"
34      echo "Discarding other changes."
35      "$GIT" checkout .
36  done
37  
38  "$GIT" status
39