OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
1.9 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-update-tree
  6. # Copyright (C) 2007 - 2008 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. #Description: Updates the entire working tree
  16. [ -n "$SDEROOT" ] ||
  17. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  18. . $SDEROOT/lib/libsde.in
  19. update_usage() {
  20. local progname=${0##*/}
  21. cat <<-EOT
  22. Usage: ${progname//-/ }
  23. EOT
  24. }
  25. shortopts=
  26. longopts='help'
  27. options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
  28. if [ $? -ne 0 ]; then
  29. update_usage
  30. exit -1
  31. fi
  32. # load new arguments list
  33. eval set -- "$options"
  34. GITSERVER="git://git.opensde.net"
  35. while [ $# -gt 0 ]; do
  36. case "$1" in
  37. --help)
  38. update_usage
  39. exit 0 ;;
  40. --) shift; break ;;
  41. *) echo_abort 1 "Unknown argument '$1', aborting."
  42. esac
  43. shift
  44. done
  45. indent_output() {
  46. sed -e '/^$/d;' -e 's/^/ /'
  47. }
  48. # jump to the working tree's root
  49. #
  50. cd "$SDEROOT"
  51. tree="${SDEROOT##*/}"
  52. # hunt for the roots of the sub-working trees
  53. #
  54. for x in . package $( ls -1d package/* target/* 2> /dev/null ); do
  55. if [ ! -d "$x" ]; then
  56. case "$x" in
  57. package)
  58. echo "$tree/$x:"
  59. ( git clone --quiet \
  60. "$GITSERVER/opensde/$x-nopast.git" "$x" 2>&1 &&
  61. echo "$x: cloned successfully"
  62. ) | indent_output
  63. ;;
  64. *)
  65. echo "$tree/$x: missing" >&2
  66. ;;
  67. esac
  68. elif [ -d "$x/.git" ]; then
  69. cd "$x";
  70. echo "$tree/$x:"
  71. ( git fetch --quiet && git reset && git rebase origin ) 2>&1 | indent_output
  72. cd - > /dev/null
  73. elif [ -d "$x/.svn" ]; then
  74. cd "$x";
  75. echo "$tree/$x:"
  76. svn up 2>&1 | indent_output
  77. cd - > /dev/null
  78. fi
  79. done