PageRenderTime 37ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/tig-1.0/contrib/release.sh

#
Shell | 75 lines | 33 code | 14 blank | 28 comment | 4 complexity | e1942f3807b1963759ea29c39a1c0b43 MD5 | raw file
Possible License(s): GPL-2.0
  1. #!/bin/sh
  2. #
  3. # Script for preparing a release or updating the release branch.
  4. # Usage: $0 version
  5. #
  6. # Copyright (c) 2009-2012 Jonas Fonseca <fonseca@diku.dk>
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License as
  10. # published by the Free Software Foundation; either version 2 of
  11. # the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. set -e
  18. set -x
  19. VERSION="$1"
  20. TAG="tig-$VERSION"
  21. TITLE="$TAG\n$(echo "$TAG" | sed 's/./-/g')"
  22. # Require a clean repository.
  23. git update-index --refresh
  24. git diff-index --quiet HEAD
  25. if test -n "$VERSION"; then
  26. # Get a sane starting point.
  27. test "$(git symbolic-ref HEAD)" = "refs/heads/master" ||
  28. git checkout master
  29. # Update files which should reference the version.
  30. sed -i "s/VERSION\s=\s[0-9]\+[.][0-9]\+/VERSION = $VERSION/" Makefile
  31. perl -pi -e 's/^tig master.*/@@TITLE@@/ms' NEWS
  32. perl -pi -e "s/^@@TITLE@@.*/$TITLE/" NEWS
  33. # Check for typos.
  34. make spell-check
  35. # Last review.
  36. $EDITOR NEWS
  37. # Create release commit and tag.
  38. git commit -a -m "$TAG"
  39. git tag -s -m "tig version $VERSION" "$TAG"
  40. # Prepare release announcement file.
  41. ./contrib/announcement.sh "$TAG" > "$TAG.txt"
  42. # Set version for the Makefile
  43. export DIST_VERSION="$VERSION"
  44. else
  45. # Get meaningful version for the update message.
  46. TAG="$(git describe)"
  47. fi
  48. # Update the release branch.
  49. git checkout release
  50. HEAD="$(git rev-parse release)"
  51. git merge master
  52. if test -n "$(git rev-list -1 release ^$HEAD)"; then
  53. make distclean doc-man doc-html sysconfdir=++SYSCONFDIR++
  54. git commit -a -m "Update for version $TAG"
  55. fi
  56. if test -n "$VERSION"; then
  57. # Create the tarball.
  58. make dist
  59. fi
  60. # Done.
  61. git checkout master