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.

79 lines
1.7 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 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. [ -n "$SDEROOT" ] ||
  16. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  17. . $SDEROOT/lib/libsde.in
  18. update_usage() {
  19. local progname=${0##*/}
  20. cat <<EOT
  21. Usage: $progname [FILES...]
  22. EOT
  23. }
  24. shortopts=''
  25. longopts=''
  26. options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
  27. if [ $? -ne 0 ]; then
  28. list_usage
  29. exit -1
  30. fi
  31. # load new arguments list
  32. eval set -- "$options"
  33. GITSERVER=git://git.opensde.net
  34. while [ $# -gt 0 ]; do
  35. case "$1" in
  36. --) shift; break ;;
  37. *) echo_abort 1 "Unknown argument '$1', aborting."
  38. esac
  39. shift
  40. done
  41. # jump to the working tree's root
  42. #
  43. cd "$SDEROOT"
  44. tree="${SDEROOT##*/}"
  45. # hunt for the roots of the sub-working trees
  46. #
  47. for x in . package $( ls -1d package/* target/* 2> /dev/null ); do
  48. if [ ! -d "$x" ]; then
  49. case "$x" in
  50. package)
  51. echo -n "$tree/$x: "
  52. git clone --quiet "$GITSERVER/opensde/$x-nopast.git" "$x"
  53. ;;
  54. *)
  55. echo "$tree/$x: missing" >&2
  56. ;;
  57. esac
  58. elif [ -d "$x/.git" ]; then
  59. cd "$x";
  60. echo -n "$tree/$x: "
  61. git fetch --quiet && git reset && git rebase origin
  62. cd - > /dev/null
  63. elif [ -d "$x/.svn" ]; then
  64. cd "$x";
  65. echo -n "$tree/$x: "
  66. svn up
  67. cd - > /dev/null
  68. fi
  69. done