#!/bin/sh -e # # This script is put in the public domain by Henrik Nordström # . It is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # If you find this script useful then you are encouraged to send feedback # to the author, but you have absolutely no obligation to do so. # # Author: # Henrik Nordström # http://hem.passagen.se/hno/ # # Distribution URL: # http://devel.squid-cache.org/CVS.html # # Version history: # 2001-09-25 First public domain release # if [ -f CVS/Tag ]; then localtag=`cat CVS/Tag|cut -c2-` fi if [ "$1" = "-b" ]; then localtag="$2" shift shift fi if [ $# -eq 0 ] && [ -f merge.log ]; then set -- `head -1 merge.log | grep ^Merg | sed -e 's/.* //'` fi if [ $# -ne 2 ] && [ $# -ne 1 ]; then exec >&2 echo "Usage: $0 [-b branch] base-tag [patchversion]" echo " where base-tag is the base branch the diff should start from" echo " (usually HEAD, but you should know...)" echo " If patchversion is specified then a tag will be created for this" echo " patch, suitable for the diff cgi-script. This tag will be named" echo " branchname-patchversion" exit 1 fi if [ ! -f CVS/Root ] || [ ! -f CVS/Repository ]; then exec >&2 echo "ERROR: The script must be run from a CVS working directory" exit 1 fi if [ -z "$localtag" ]; then exec >&2 echo "ERROR: The script can only be run on branches. Running" echo "it on the HEAD version does not make sense." exit 1 fi rootdir=`cat CVS/Root|sed -e 's/.*://'` module=`cat CVS/Repository|sed -e "s#^$rootdir##"` mergefrom="$1" tag="${localtag}" mergetag="Z-${tag}_merge_${mergefrom}" patchversion="$2" ecvs() { echo cvs $* >&2 cvs "$@" } o () { echo "# $*..." } if [ -n "$patchversion" ]; then tag="${tag}-${patchversion}" mergetag2="Z-${tag}_merge_${mergefrom}-$patchversion" ecvs -q rtag -r "$mergetag" $mergetag2 $module || true ecvs -q rtag -r "$localtag" $tag $module || true mergetag="$mergetag2" fi echo "Patch file generated `date` from" if [ "$tag" != "$localtag" ]; then echo "CVS tag: ${tag}" fi echo "CVS branch ${localtag}" echo "CVS base branch ${mergefrom}" echo "CVS repository: `cat CVS/Root`" echo "CVS module: $module" echo echo "cvs -q rdiff -u -kk -r ${mergetag} -r ${tag} ${module}" ecvs -q rdiff -u -kk -r ${mergetag} -r ${tag} ${module} | cleanpatch