A simple shell script to help MFC an entire directory to a branch where it

does not already exist.
This commit is contained in:
des 2004-09-24 15:24:12 +00:00
parent aee3a2ada1
commit 07d69e2434
2 changed files with 48 additions and 0 deletions

10
tools/tools/mfc/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $FreeBSD$
BINDIR?= ${HOME}/bin
BINOWN?= `id -u`
BINGRP?= `id -g`
SCRIPTS= mfc.sh
MAN= # none
.include <bsd.prog.mk>

38
tools/tools/mfc/mfc.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
#
# Merge an entire directory from HEAD to a given branch
#
# $FreeBSD$
#
if [ $# -eq 1 -a -f CVS/Tag ] ; then
set -- "${1}" "$(sed -e 's/^T//' <CVS/Tag)"
echo "Assuming branch is $2"
fi
if [ $# -ne 2 ] ; then
echo "usage: mfc <dir> <branch>" 1>&2
exit 1
fi
dir="${1}"
branch="${2}"
set -e
# Get sources from HEAD
/usr/bin/cvs -f -Q up -kk -Pd -A "${dir}"
# Fake a cvs add...
find "${dir}" -type d -name CVS |
while read d ; do
echo "${d%/CVS}"
# Fix up Entries so the files look newly added
sed -E -i'' -e \
"s|^/([^/]+)/.*|/\1/0/Merged \1 from HEAD//T${branch}|" \
"${d}/Entries"
# Set directory tag
echo "T${branch}" >"$d/Tag"
done