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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
#!/bin/sh
#
# Seems like `gbp dch' doesn't work well with non-linear histories. With
# pkg-zsh we do have merges everytime an upstream release is done. That's
# where "Upstream Release ChangeLog" comes into play. It takes a set of
# commit hashes and produces an initial changelog update for those
# situations in which an upstream release tag was merged. After that,
# the situation can be reduced to a linear history again and `gbp dch'
# will do just fine.
#
# This script is pretty dumb, so some manual adjustments might be needed
# for "debian/changelog".
if [ $# = 0 ]; then
printf 'usage: urcl [OPTIONS] <COMMITHASH(s)...>\n\n'
printf 'Options:\n\n'
printf ' -n="..." Full name to be used for the changelog entry. (Defaults\n'
printf ' to "$DEBFULLNAME".)\n'
printf ' -m="..." Email address for the changelog entry. (Defaults to\n'
printf ' "$DEBEMAIL".)\n'
printf ' -p="..." Package name to use. (Defaults to "$PACKAGE".)\n'
printf ' -v="..." Version number to use. (Defaults to "$VERSION".)\n'
printf '\n'
exit 0
fi
case "$1" in
-*) isopt=1;;
*) isopt=0;;
esac
while [ "$#" -gt 0 ] && [ "$isopt" = 1 ]; do
case "$1" in
-n=*) who="${1#-n=}" ;;
-m=*) ewho="${1#-m=}" ;;
-p=*) PACKAGE="${1#-p=}" ;;
-v=*) VERSION="${1#-v=}" ;;
-*)
printf 'Unknown option `%s'\''\n.' "$1"
;;
esac
shift
case "$1" in
-*) isopt=1;;
*) isopt=0;;
esac
done
if [ x"$who" = x ]; then
if [ x"$DEBFULLNAME" = x ]; then
printf '`$DEBFULLNAME'\'' is empty use -n=...\n'
exit 1
fi
who=$DEBFULLNAME
fi
if [ x"$ewho" = x ]; then
if [ x"$DEBEMAIL" = x ]; then
printf '`$DEBEMAIL'\'' is empty use -m=...\n'
exit 1
fi
ewho=$DEBEMAIL
fi
if [ x"$PACKAGE" = x ]; then
printf '`$PACKAGE'\'' is empty use -p=...\n'
exit 1
fi
if [ x"$VERSION" = x ]; then
printf '`$VERSION'\'' is empty use -v=...\n'
exit 1
fi
DATE=$(date -R)
ours="debian/changelog.urcl"
theirs="debian/changelog.old"
cl="debian/changelog"
xecho () {
printf '%s\n' "$@" >> "$ours"
}
rm -f "$ours" "$theirs"
xecho "$PACKAGE ($VERSION) UNRELEASED; urgency=low"
xecho
for rev; do
data=$(git log -1 --abbrev=8 --pretty=format:' * [%h] %s' "$rev")
[ $? = 0 ] && xecho "$data"
done
xecho
xecho " -- ${who} <${ewho}> $DATE"
xecho
cp "$cl" "$theirs"
cat "$ours" > "$cl"
cat "$theirs" >> "$cl"
rm -f "$ours" "$theirs"
${VISUAL:-${EDITOR:-vi}} "$cl"
|