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.

76 lines
2.2 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: scripts/Create-Diff
  6. # Copyright (C) 2006 - 2007 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. directories="misc package lib architecture target scripts"
  18. if [ "$1" = "-editor" ] ; then
  19. editor="$2" ; shift ; shift
  20. fi
  21. if [ "$#" -lt 2 ] ; then
  22. echo ; echo " Usage: $0 [ -editor <editor> ] <old-dir> <new-dir> [ {file|directory} ]"
  23. echo
  24. echo " Creates a unified diff over two OpenSDE source trees. You can"
  25. echo " send this diff to the mailing list if you want your changes"
  26. echo " to be included."
  27. echo
  28. echo " Please do create seperate diffs for changes which do not"
  29. echo " belong to each other."
  30. echo ; exit 1
  31. else
  32. olddir=$1; shift
  33. newdir=$1; shift
  34. [ "$1" ] && directories="$*"
  35. fi
  36. if ! perl -e 'exit 0' ; then
  37. perl() { cat ; }
  38. fi
  39. eval "`grep -A 10 '\[BEGIN\]' $olddir/lib/parse-config | grep -B 10 '\[END\]'`"
  40. [ "$editor" = "" ] && echo "[ Generated by ./scripts/Create-Diff for OpenSDE $sdever ]" > /tmp/$$
  41. for x in $directories ; do
  42. x=${x#./}; x=${x%/}
  43. if [ -d $x ]; then
  44. FLAGS="-rduN"
  45. name_for_diff="$x/."
  46. source_for_sed="$x/./"
  47. target_for_sed="$x/"
  48. else
  49. FLAGS="-duN"
  50. name_for_diff="$x"
  51. source_for_sed=""
  52. target_for_sed=""
  53. fi
  54. diff -x CVS -x '.svn' -x '.#*' -x '*.mine' -x '*.r[1-9][0-9]*' \
  55. $FLAGS "$olddir"/$name_for_diff "$newdir"/$name_for_diff | grep -v '^diff ' | \
  56. sed "s,^--- $olddir/$source_for_sed,--- ./$target_for_sed," | \
  57. sed "s,^+++ $newdir/$source_for_sed,+++ ./$target_for_sed," | \
  58. perl -pe '$fn=$1 if /^--- \.\/(\S+)\s/;
  59. $_="" if $fn =~ /~$/'
  60. done | perl -w `dirname $0`/patch-pp.pl "$newdir" >> /tmp/$$
  61. if [ "$editor" = "" ]; then
  62. cat /tmp/$$
  63. rm /tmp/$$
  64. else
  65. eval "$editor /tmp/$$"
  66. rm /tmp/$$
  67. fi