update-apps.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. #
  3. # SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. #
  6. # Update Nextcloud apps from latest git master
  7. # For local development environment
  8. # Use from Nextcloud server folder with `./build/update-apps.sh`
  9. #
  10. # It automatically:
  11. # - goes through all apps which are not shipped via server
  12. # - shows the app name in bold and uses whitespace for separation
  13. # - changes to master/main and pulls quietly
  14. # - shows the 3 most recent commits for context
  15. # - removes branches merged into master/main
  16. # - … could even do the build steps if they are consistent for the apps (like `make`)
  17. set -euo pipefail
  18. for path in apps*/*/.git; do
  19. (
  20. path="$(dirname "$path")"
  21. cd "$path"
  22. printf "\n\033[1m${PWD##*/}\033[0m\n"
  23. branch="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"
  24. git checkout "$branch"
  25. git pull --quiet -p
  26. git --no-pager log -3 --pretty=format:"%h %Cblue%ar%x09%an %Creset%s"
  27. printf "\n"
  28. git branch --merged "$branch" | grep -v "$branch$" | xargs git branch -d || true
  29. )
  30. done