blob: e3e33008e5285982ad993e132a415151bda70dfa (
plain) (
blame)
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
|
#!/bin/bash
set -e
[ -n "$DEBUG" ] && set -x
if [ "$1" = "-h" ]; then
echo "usage: $(basename "${0}") DEPENDENCY [from] TO"
echo
exit 0
fi
dependency=$1
from=$2
to=$3
if [ -z "${dependency}" ]; then
echo "error: missing dependency to bump, see -h" >&2
exit 1
fi
if [ -z "${to}" ]; then
to=$from
from=$(git log --format=%b | awk "{ if(match(\$0,/[Uu]pdate ${dependency} from (.+) to (.+)$/,m)) print(m[2]); exit(0) }")
if [ -z "${from}" ]; then
# still no $from, let's give the user a choice using fzf
from=$(git log --format=%b | awk "{ if(match(\$0,/[Uu]pdate (.+) from (.+) to (.+)$/,m)) print m[0] }" | fzf | sed 's#.*to \(.*\)$#\1#')
fi
fi
if [ -z "${to}" ]; then
echo "error: missing version to bump to, see -h" >&2
exit 1
fi
git commit --edit --file <(
cat <<-EOF
Update ${dependency} to ${to}
Update ${dependency} from ${from} to ${to}
Change-type: patch
Signed-off-by: $(git config user.name) $(git config user.signemail || git config user.email)
EOF
)
|