dotfiles/dot_local/bin/executable_xxbranchupdates

68 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2023-09-15 15:46:04 -04:00
#!/bin/sh
# always capture the current branch so we can go back to it :)
current_branch="$(git branch --show-current)"
_default() {
if [ -n "$1" ]; then
git checkout -q "$1"
fi
branch_name="$(git branch --show-current)"
update_list=""
for p in $(common/travis/changed_templates.sh 2>&1 >/dev/null); do
if [ -z "$update_list" ]; then
update_list=$("${XBPS_DISTDIR}"/xbps-src update-check "$p" 2>&1)
else
appendee=$("${XBPS_DISTDIR}"/xbps-src update-check "$p")
if [ -n "$appendee" ]; then
# yay explicit newline :(
update_list="${update_list}
${appendee}"
fi
fi
done
if [ -n "$update_list" ]; then
printf "branch: %s\n%s\n\n" "$branch_name" "$update_list"
fi
}
_maint() {
git checkout -q master
for b in $(git branch --list 'maint*'); do
_default "$b"
done
}
_update() {
git checkout -q master
for b in $(git branch --list 'update*'); do
_default "$b"
done
}
_organized() {
git checkout -q master
for b in $(git branch --list '*/*'); do
_default "$b"
done
}
if [ $# = 0 ]; then
_default
else
while test $# != 0
do
case "$1" in
-m|--maint) _maint;;
-u|--update) _update;;
-o|--organized) _organized;;
--) shift; break;;
*) _default;;
esac
shift
done
fi
# return to branch we were on before running script
git checkout "$current_branch" >/dev/null 2>&1