blob: 9794aba53db0bdac15c4173d21146895ca8547ac (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#!/usr/bin/env bash
set -euo pipefail
SCRIPT=$(basename "$0")
TOP=$(dirname "$0")/..
function usage()
{
cat <<EOF
${SCRIPT}: List crates that have changed since a given tag
Usage:
${SCRIPT} [opts] TAG
Options:
-h: Print this message.
-u: Exclude all crates whose version numbers have changed.
EOF
}
CHECK_VERSION=no
VERBOSE=no
while getopts "uvh" opt ; do
case "$opt" in
h) usage
exit 0
;;
u) CHECK_VERSION=yes
;;
v) VERBOSE=yes
;;
*) echo "Unknown option. Run with -h for help."
exit 1
;;
esac
done
# Discard parsed options.
shift $((OPTIND-1))
TAG="${1:-}"
if [ $VERBOSE = "yes" ]; then
function whisper() {
echo " " "$*" >&2
}
else
function whisper() {
:
}
fi
if [ -z "$TAG" ]; then
echo "You need to give a git revision as an argument."
exit 1
fi
for crate in $("${TOP}/maint/list_crates"); do
if [ ! -d "${TOP}/crates/${crate}" ]; then
echo " Skipping example crate ${crate}" >&2
continue
fi
if git diff --quiet "$TAG..HEAD" "${TOP}/crates/${crate}"; then
whisper "$crate: No change."
:
else
if [ $CHECK_VERSION = 'no' ]; then
echo "$crate"
else
V0=$(git show "$TAG:crates/${crate}/Cargo.toml" | grep -m1 '^version ' || true)
V1=$(git show "HEAD:crates/${crate}/Cargo.toml" | grep -m1 '^version ' || true)
if [ "$V0" != "$V1" ] ; then
whisper "$crate: changed, and version has been bumped."
else
echo "$crate"
fi
fi
fi
done
|