ldiff 773 B

12345678910111213141516171819202122
  1. #! /bin/sh
  2. # This script makes pretty looking patches provided that the old files
  3. # are kept around with the .v0 suffix.
  4. : ${backup_suffix=${1:-"\.v0"}}
  5. backup_files=`find . -path "*$backup_suffix" -type f | sort -u`
  6. for oldfile in $backup_files; do
  7. newfile=`echo $oldfile | sed 's,^\./,,;s/'$backup_suffix'$//'`
  8. oldlabel="$oldprefix$newfile"
  9. newlabel="$newprefix$newfile"
  10. find "$oldfile" ! -size 0 | grep . >/dev/null || \
  11. { oldfile="/dev/null"; oldlabel="/dev/null"; }
  12. find "$newfile" ! -size 0 | grep . >/dev/null || \
  13. { newfile="/dev/null"; newlabel="/dev/null"; }
  14. case $newfile in
  15. *.c) dflags="-u -p" ;;
  16. *.po) dflags='-U 1 -I^#[:,.~]';;
  17. *) dflags="-u" ;;
  18. esac
  19. diff $dflags -L "$oldlabel" -L "$newlabel" "$oldfile" "$newfile"
  20. done