check-newsfragment 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. #
  3. # A script which checks that an appropriate news file has been added on this
  4. # branch.
  5. set -e
  6. # make sure that origin/develop is up to date
  7. git remote set-branches --add origin develop
  8. git fetch --depth=1 origin develop
  9. UPSTREAM=origin/develop
  10. # if there are changes in the debian directory, check that the debian changelog
  11. # has been updated
  12. if ! git diff --quiet $UPSTREAM... -- debian; then
  13. if git diff --quiet $UPSTREAM... -- debian/changelog; then
  14. echo "Updates to debian directory, but no update to the changelog." >&2
  15. exit 1
  16. fi
  17. fi
  18. # if there are changes *outside* the debian directory, check that the
  19. # newsfragments have been updated.
  20. if git diff --name-only $UPSTREAM... | grep -qv '^develop/'; then
  21. tox -e check-newsfragment
  22. fi
  23. echo
  24. echo "--------------------------"
  25. echo
  26. # check that any new newsfiles on this branch end with a full stop.
  27. for f in `git diff --name-only $UPSTREAM... -- changelog.d`; do
  28. lastchar=`tr -d '\n' < $f | tail -c 1`
  29. if [ $lastchar != '.' ]; then
  30. echo -e "\e[31mERROR: newsfragment $f does not end with a '.'\e[39m" >&2
  31. exit 1
  32. fi
  33. done